A tunnel surrounding rock question and answer method and system fusing a knowledge graph and semantic retrieval
By constructing a standard question-and-answer pair dataset and a knowledge graph entity library for tunnel surrounding rock, and combining a large language model and a vector index library, the problems of missing logical connections and semantic biases in standard question-and-answer systems for tunnel surrounding rock were solved, realizing a trustworthy and auditable question-and-answer system for high-risk engineering scenarios.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA HYDROELECTRIC ENGINEERING CONSULTING GROUP CHENGDU RESEARCH HYDROELECTRIC INVESTIGATION DESIGN AND INSTITUTE
- Filing Date
- 2026-05-09
- Publication Date
- 2026-06-09
AI Technical Summary
Existing technologies lack deep multi-hop knowledge reasoning capabilities in standard question-and-answer scenarios for tunnel surrounding rock, have insufficient semantic and structural integration, and lack support from professional domain question-and-answer datasets. This results in missing logical connections, insufficient authority, and semantic bias, making it difficult to meet the traceability and auditability requirements in high-risk scenarios.
We construct an industry-standard question-answering dataset and a knowledge graph entity library. We extract key entities and intent tags through a large language model, perform a three-hop neighborhood traversal to generate a structured logical chain, and combine a vector index library for semantic similarity retrieval. We also perform background completion and conflict verification to finally generate an answer that matches the user's intent and has textual source evidence.
It significantly improves the ability to restore deep logic, the accuracy of semantic matching, and the authority of generated content in standard Q&A for tunnel surrounding rock, providing trustworthy and auditable technical support, suppressing the generation of knowledge illusions, and is suitable for high-risk engineering scenarios.
Smart Images

Figure CN122175013A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and natural language processing technology, specifically to a tunnel surrounding rock question-answering method and system that integrates knowledge graphs and semantic retrieval. Background Technology
[0002] As Large Language Models (LLM) and Retrieval-Augmented Generation (RAG) technologies demonstrate their powerful capabilities in tasks such as general knowledge-based question answering, the demand for high reliability and authority in generated content is becoming increasingly prominent. In highly specialized application scenarios such as tunnel surrounding rock standard question answering, LLM often lacks deep logical connections or data rigor when processing surrounding rock morphology identification and decision-making specifications and industry standard provisions, generating seemingly fluent but ultimately deviating content from the standard provisions. Such errors can lead to serious compliance risks in high-risk and serious scenarios such as engineering design, safe production, and administrative approvals. Therefore, achieving accurate, in-depth, and authoritative retrieval of tunnel surrounding rock standards has become a key challenge in the field of trustworthy artificial intelligence applications.
[0003] Currently, enhancement methods for domain-specific question answering mainly focus on simple semantic retrieval or shallow knowledge enhancement. Typical methods include the following categories:
[0004] The first category is semantic recall methods based on vector space similarity. These methods convert query statements and document fragments into embedded vectors and calculate their cosine similarity to recall the text fragments most relevant to the query semantics. Although these methods are highly versatile, they have obvious drawbacks: (1) Broken logical chains: Standard documents for tunnel surrounding rock often have complex referencing relationships, and simple semantic similarity is difficult to capture the logical topology across documents, resulting in one-sided answers; (2) Keyword offset: In scenarios with a high density of professional terms, semantically similar fragments may not be key evidence on the specific query entity, making it difficult to meet the need for accurate positioning of the text.
[0005] The second category is multi-hop neighbor retrieval methods based on knowledge graphs. Some studies have attempted to use knowledge graphs to store entity relationships and retrieve directly associated attributes or neighbor nodes by matching the core entities in the query statement as anchor points. However, these methods typically only handle simple factual questions and answers and do not delve into in-depth knowledge mining. More importantly, existing technologies mostly remain at the stage of single-point knowledge extraction, lacking systematic analysis of deep implicit relationships between entities, making it difficult to handle complex tunnel surrounding rock logic consultations involving preconditions, scope of application, and exclusivity clauses.
[0006] The third category is generation methods based on fine-tuning of general tunnel surrounding rock corpora. These methods typically use general instruction datasets or open-domain corpora to fine-tune large language models, aiming to improve the model's generation capabilities for specific tasks. However, general datasets often rely on empirical or weakly constrained textual expressions, generally lacking the standardized terminology, strict logical structure, and clause-level semantic constraints required by specific standards and industry norms for tunnel surrounding rock. Furthermore, standard and industry normative texts are typically large in scale, have complex hierarchical structures, and are frequently updated. Fine-tuning the model using all or a large number of industry texts not only consumes significant computational resources and training time but also, with limited model parameter size, struggles to fully preserve fine-grained normative information and may even introduce semantic biases from general corpora, thus affecting the model's generation accuracy and stability in specialized domains.
[0007] In summary, the existing technology has the following core problems:
[0008] First, there is a lack of deep, multi-hop knowledge reasoning ability. Existing methods cannot effectively mine three-hop or higher neighbor relationships between entities, which limits the ability to fully reconstruct the logical chain of tunnel surrounding rock industry standards and makes it difficult to capture indirect references, constraints, and subordinate relationships between standard provisions.
[0009] Second, the integration of semantics and structure is insufficient. Existing technologies fail to effectively combine the semantic similarity of vector space with the topological structure information of knowledge graphs, resulting in an imbalance between "intent matching" and "factual relevance" in search results. This makes it difficult to guarantee semantic relevance, as well as the authority and logical integrity of the evidence.
[0010] Third, there is a lack of professional domain-specific question-and-answer datasets. Existing solutions rely too heavily on general corpora and lack high-precision question-and-answer pair datasets built based on standards and industry documents. This makes it difficult to guarantee the rigor and legal validity of the generated content and fails to meet the technical requirements for traceability and auditability in high-risk scenarios. Summary of the Invention
[0011] This invention aims to address the problems of lack of logical connection, insufficient authority, and semantic bias in existing technologies for standard question-and-answer scenarios in tunnel surrounding rock, and proposes a question-and-answer method and system for tunnel surrounding rock that integrates knowledge graphs and semantic retrieval.
[0012] The technical solution adopted by the present invention to solve the above-mentioned technical problems is as follows:
[0013] In a first aspect, the present invention provides a tunnel surrounding rock question-answering method that integrates knowledge graphs and semantic retrieval, the method comprising:
[0014] The collected standard documents and industry specification documents for tunnel surrounding rock are structured and parsed to extract the main text of the clauses and the constraints, references and subordinate relationships between the clauses. Based on this, an industry standard question and answer pair dataset and a corresponding vector index library are constructed, and a knowledge graph entity library containing entity relationship chains is generated.
[0015] The system receives the user's original query statement, calls the pre-trained large language model interface, identifies and extracts key entities and intent tags from the original query statement, and maps the key entities to the knowledge graph entity library as initial anchor entities.
[0016] Centered on the initial anchor entity, a three-hop neighborhood traversal is performed in the knowledge graph entity library, and the priority direction of the neighborhood traversal is determined according to the intent tag. The three-hop neighbor nodes and relation triples of the initial anchor entity are obtained, and a structured logic chain for restoring the indirect reference logic between standard clauses is generated.
[0017] The original query statement is transformed into a query feature vector. Nearest neighbor search is performed in the vector index library. The cosine similarity between the query feature vector and the text vector in the vector index library is calculated. The top-N semantically relevant text fragments with the highest cosine similarity ranking are recalled as unstructured contextual evidence.
[0018] The structured logic chain is used to perform background completion and conflict verification on the recalled Top-N semantically relevant text fragments, and the processed text fragments are fused with the structured logic chain to form a fused evidence chain;
[0019] Based on the standard paradigm in the industry standard question-and-answer dataset and the intent tags, the fused evidence chain is subject to compliance constraints to generate a final answer that matches the user's intent and has textual source evidence.
[0020] Furthermore, after generating the structured logic chain used to reconstruct the indirect reference logic between standard clauses, it also includes:
[0021] The knowledge coverage rate is calculated and output along with the final question and answer. This rate is used to evaluate the ability of the structured logic chain to reconstruct the standard deep logic chain of the tunnel surrounding rock. The calculation formula is as follows:
[0022] ;
[0023] in, Indicates knowledge coverage. This represents the set of entities that form the initial anchor points. This represents the set of entity evidence contained in the standard answers of the industry standard question-answering dataset. This represents the set of three-hop neighbor nodes obtained by performing a three-hop neighborhood traversal centered on the initial anchor entity. This indicates the number of elements in the set.
[0024] Furthermore, after recalling the top-N semantically relevant text fragments with the highest cosine similarity ranking, it also includes:
[0025] A semantic consistency score is calculated and output along with the final question and answer. This score evaluates the degree to which the Top-N semantically relevant text fragments match the user's true intent. The calculation formula is as follows:
[0026] ;
[0027] in, Indicates semantic consistency score, This indicates the number of semantically relevant text fragments recalled. This represents the query feature vector. Represents the first in the vector index library A vector of recalled text fragments, This represents the preset weight decay coefficient. Denotes the Euclidean norm. Indicates the query feature vector and the first The cosine similarity of the vectors of each clause segment.
[0028] Furthermore, after generating the final answer with verifiable source material, it also includes:
[0029] Calculate the comprehensive evaluation index and output it along with the final question and answer. The comprehensive evaluation index is used to measure the overall retrieval accuracy, and its calculation formula is as follows:
[0030] ;
[0031] in, This represents the comprehensive evaluation indicators. Indicates knowledge coverage. This represents the semantic consistency score.
[0032] Furthermore, the pre-trained large language model interface identifies core business entities and technical indicator keywords from the original query statement by designing targeted prompt words as the key entities, and identifies intent tags from the original query statement.
[0033] Furthermore, taking the initial anchor entity as the center, a neighborhood traversal with a depth of three hops is performed in the knowledge graph entity database, specifically including:
[0034] Starting from the initial anchor point entity, the priority traversal direction is determined according to the intent tag. All its directly associated one-hop neighbor nodes are traversed. Then, starting from the one-hop neighbor node, its associated two-hop neighbor nodes are traversed. Finally, starting from the two-hop neighbor node, its associated three-hop neighbor nodes are traversed to restore the indirect reference logic between standard clauses.
[0035] Furthermore, the structured logic chain is used to perform background completion and conflict verification on the recalled Top-N semantically relevant text fragments, specifically including:
[0036] Obtain the entities contained in the structured logic chain and the topological structure information between entities;
[0037] Entity extraction is performed on the Top-N semantically related text fragments to obtain the first entity set;
[0038] The first entity set is compared with the entities in the structured logic chain to identify the associated text fragments in the Top-N semantically related text fragments that have entity association with the structured logic chain, as well as the isolated text fragments that do not have entity association with the structured logic chain.
[0039] The topological information is used to complete the background of related clause fragments, supplementing them with information on preconditions, scope of application, or exclusive clauses associated with them in the structured logical chain;
[0040] The isolated text fragments are marked as noise information and denoised, and then removed or have their weight reduced from the recalled Top-N semantically relevant text fragments.
[0041] Furthermore, the processed text fragments are integrated with the structured logic chain, specifically including:
[0042] Determine the second set of entities of the initial anchor entity in the structured logic chain, and the third set of entities of the initial anchor entity in the processed text fragment;
[0043] Calculate the entity overlap degree between the second entity set and the third entity set. The entity overlap degree is used to characterize the degree of association between the structured logic chain and the processed text fragment at the entity level.
[0044] The processed text fragments are reordered based on the entity overlap degree, wherein the text fragments with higher entity overlap degree have higher weight in the reordering.
[0045] The reordered text fragments are then merged with the structured logic chain.
[0046] Furthermore, compliance constraints are imposed on the fusion of evidence chains, specifically including:
[0047] The fused evidence chain is compared with the standard paradigm in the industry standard question-and-answer dataset. Based on the intent label, the standard paradigm that matches the user intent is selected, and the evidence entries in the fused evidence chain that match the standard paradigm are identified.
[0048] Based on the wording format, logical structure, and terminology specifications stipulated in the standard paradigm, the fused evidence chain is subject to compliance constraints, and is adjusted to a standardized expression that conforms to the industry standard question-and-answer pair dataset central standard paradigm.
[0049] The fused evidence chain, after compliance constraints, is used to generate traceability information, including the source of the clause, clause number, and citation relationship, in accordance with the evidence citation presentation method in the standard paradigm.
[0050] Based on the standardized expression and traceability information, a final answer that matches the user's intent and has textual traceability is generated.
[0051] Secondly, the present invention provides a tunnel surrounding rock question-answering system integrating knowledge graphs and semantic retrieval, for implementing the tunnel surrounding rock question-answering method integrating knowledge graphs and semantic retrieval as described in the first aspect, the system comprising:
[0052] The database construction module is used to perform structured parsing of collected tunnel surrounding rock standard documents and industry specification documents, extract the main text of the clauses and the constraints, references and subordinate relationships between the clauses, and build an industry standard question and answer pair dataset and a corresponding vector index library based on this, and generate a knowledge graph entity library containing entity relationship chains;
[0053] The multidimensional entity extraction module is used to receive the original query statement input by the user, call the pre-trained large language model interface, identify and extract key entities and intent tags from the original query statement, and map the key entities to the knowledge graph entity library as initial anchor entities.
[0054] The dual-path joint recall module is used to perform a three-hop neighborhood traversal in the knowledge graph entity database centered on the initial anchor entity, and determine the priority direction of the neighborhood traversal according to the intent tag, obtain the three-hop neighbor nodes and relation triples of the initial anchor entity, and generate a structured logical chain for reconstructing the indirect reference logic between standard clauses; the original query statement is transformed into a query feature vector, a nearest neighbor search is performed in the vector index database, the cosine similarity between the query feature vector and the clause vector in the vector index database is calculated, and the top-N semantically relevant clause fragments with the highest cosine similarity ranking are recalled as unstructured contextual evidence;
[0055] The knowledge conflict verification module is used to perform background completion and conflict verification on the recalled Top-N semantically related text fragments using the structured logic chain, and to fuse the processed text fragments with the structured logic chain to form a fused evidence chain;
[0056] The enhanced answer generation module is used to apply compliance constraints to the fused evidence chain based on the standard paradigm in the industry standard question and answer dataset and the intent tags, and generate a final answer that matches the user's intent and has textual source evidence.
[0057] The beneficial effects of this invention are as follows: The tunnel surrounding rock question-answering method and system integrating knowledge graph and semantic retrieval provided by this invention constructs an industry standard question-answering dataset and simultaneously establishes a knowledge graph entity library and vector index library. After receiving user queries, it extracts key entities and intent tags. On the one hand, it uses key entities as initial anchor entities to perform a three-hop neighborhood traversal and determines the priority direction of the neighborhood traversal based on intent tags, generating a structured logical chain for restoring the indirect reference logic between standard clauses. On the other hand, it performs semantic similarity retrieval in parallel to recall Top-N semantically relevant clause fragments, and then performs background completion and conflict verification on the dual-path recall results. The system then integrates evidence chains and combines them with industry-standard question-and-answer formats to enforce compliance with standard paradigms and intent tags in the dataset. This results in authoritative answers that match user intent and have verifiable source material, effectively addressing core issues in existing technologies such as broken logical chains, insufficient semantic and structural integration, and the lack of professional question-and-answer datasets. It significantly improves the deep logic reconstruction capability, semantic matching accuracy, and authoritativeness of generated content in standard question-and-answer formats for tunnel surrounding rock, suppressing knowledge illusions at the source. This provides trustworthy and auditable technical support for high-risk engineering scenarios and offers significant advantages such as user-friendly deployment, rapid response, and low engineering implementation costs. Attached Figure Description
[0058] Figure 1 A flowchart illustrating the tunnel surrounding rock question-answering method that integrates knowledge graphs and semantic retrieval, provided as an example;
[0059] Figure 2 A schematic diagram of the framework of a tunnel surrounding rock question-and-answer system that integrates knowledge graphs and semantic retrieval, provided for an embodiment. Detailed Implementation
[0060] Existing methods for standard question answering in tunnel surrounding rock mainly include semantic recall based on vector space similarity, multi-hop neighbor retrieval based on knowledge graphs, and generative question answering based on fine-tuning of general corpora. Because these methods fail to effectively integrate the intent matching capability of semantic similarity with the topological structure information of knowledge graphs, and lack a high-precision question answering dataset built based on standards as a compliance constraint benchmark, it is difficult to achieve a balance between logical completeness, authoritative source tracing, and semantic accuracy in the retrieval results. Based on this, the technical solution of this invention is proposed.
[0061] In this invention, the standards and industry specifications for tunnel surrounding rock are first structurally parsed to extract the constraints, references, and dependencies between clauses. Based on this, an industry standard question-and-answer dataset, a vector index library, and a knowledge graph entity library containing entity relationship chains are constructed, laying a traceable and authoritative data foundation for subsequent retrieval and generation. After receiving a user query, intent tags are extracted through a pre-trained large language model interface, and key entities are extracted as initial anchor entities. On the one hand, a three-hop neighborhood traversal is performed in the knowledge graph entity library with this anchor entity as the center. The priority direction of the neighborhood traversal is determined according to the intent tags, and three-hop neighbor nodes and relationship triples are obtained to generate a structured logical chain that restores the indirect reference logic between standard clauses. This effectively solves the defects of broken logical chains and difficulty in capturing cross-document reference relationships in the prior art. On the other hand, the query statement is transformed into a query feature vector. In the vector index, the top-N semantically relevant text fragments with the highest cosine similarity ranking are recalled using cosine similarity nearest neighbor search as unstructured contextual evidence, ensuring accurate matching between search results and user intent. Subsequently, the recalled top-N semantically relevant text fragments are supplemented with background information and conflict verification using structured logical chains. The processed text fragments are then fused with the structured logical chains to form a fused evidence chain, achieving deep integration of semantic similarity and knowledge graph topology. This overcomes the imbalance between intent matching and factual association in a single search method. Finally, the fused evidence chain is subject to compliance constraints based on industry standard question answering paradigms and intent labels in the dataset, generating a final answer that matches the user intent and has textual source tracing evidence. This suppresses the generation of knowledge illusion from the source and provides trustworthy and auditable authoritative technical support for high-risk engineering scenarios.
[0062] The technical solutions in this embodiment will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0063] Figure 1 A flowchart illustrating a question-answering method for tunnel surrounding rock that integrates knowledge graphs and semantic retrieval is shown. Please refer to [link / reference]. Figure 1 The method includes the following steps:
[0064] Step 1: Construct a benchmark database:
[0065] The collected standard documents and industry specification documents for tunnel surrounding rock are structured and parsed to extract the main text of the clauses and the constraints, references and subordinate relationships between the clauses. Based on this, an industry standard question and answer pair dataset and a corresponding vector index library are constructed, and a knowledge graph entity library containing entity relationship chains is generated.
[0066] In practical applications, standard documents, industry specifications, and relevant authoritative technical documents in the field of tunnel surrounding rock are collected and organized as raw data sources. These documents are structured and parsed using a combination of pre-defined rule-based parsing algorithms and manual verification. The main text of the clauses is extracted, and the relationships between clauses—such as the mandatory constraint of one clause on another, citation relationships (such as one clause citing a specific clause in another standard document), and subordinate relationships (such as the hierarchical affiliation of a sub-clause and its parent clause)—are identified. Based on this extracted relationship information, a knowledge graph entity library containing entity relationship chains is constructed. Entities include standard names, clause numbers, and technical parameters, while relationships cover the aforementioned constraint, citation, and subordinate types. Furthermore, a high-precision industry standard question-and-answer pair dataset is created using the extracted standard clause content. This dataset, based on the standard clauses, generates logically related question-and-answer pairs through fine-tuning of large model instructions or manual verification, for compliance verification in subsequent generation stages. Simultaneously, the standard clauses are converted into high-dimensional embedding vectors, and a corresponding vector index library is established to support subsequent semantic similarity retrieval. Through the above process, a traceable, structured, and authoritative data foundation is provided for the entire question-and-answer system.
[0067] Step 2: Perform real-time query parsing and entity discovery:
[0068] The system receives the user's original query statement, calls the pre-trained large language model interface, identifies and extracts key entities and intent tags from the original query statement, and maps the key entities to the knowledge graph entity library as initial anchor entities.
[0069] In practical applications, the system receives raw queries related to tunnel surrounding rock input from users in natural language, such as "What is the anchor bolt spacing for Class IV surrounding rock?", "Can the thickness of shotcrete in a deep-buried tunnel be less than 10 cm?", and "How should the surrounding rock grade be adjusted when constructing in a fault fracture zone?". After receiving the raw query, a pre-trained large language model interface (such as the Doubao API) is invoked for semantic parsing. To achieve accurate identification of tunnel surrounding rock terminology, this embodiment guides the large language model with targeted prompts, focusing it on extracting core business entities and technical indicator keywords related to tunnel surrounding rock from the query. Specifically, the prompts explicitly require the model to identify proper nouns such as "surrounding rock grade," "support parameters," "anchor bolt spacing," and "shotcrete thickness," as well as technical indicator keywords such as "maximum," "minimum," and "must not be less than," ensuring that the extracted key entities accurately reflect the core intent of the user's query. In this way, unstructured user natural language queries are accurately mapped to processable structured entity representations.
[0070] After extracting key entities, the system further combines intent tag recognition to determine the deeper needs of user queries, such as factual inquiries, conditional reasoning, or prescriptive verification. These key entities are then matched with entities in the constructed knowledge graph entity library, mapping them to initial anchor entities in the knowledge graph. These initial anchor entities serve as the starting point for subsequent knowledge graph retrieval, providing a clear retrieval entry point for performing a three-hop neighborhood traversal, ensuring accurate alignment from user queries to structured knowledge retrieval. This process effectively overcomes the semantic mapping gap between users' non-standardized query language and the standardized terminology in standard documents.
[0071] Step 3: Perform multi-hop topology association mining:
[0072] Centered on the initial anchor entity, a three-hop neighborhood traversal is performed in the knowledge graph entity library. The priority direction of the neighborhood traversal is determined according to the intent tag. The three-hop neighbor nodes and relation triples of the initial anchor entity are obtained, and a structured logic chain for restoring the indirect reference logic between standard clauses is generated.
[0073] Specifically, the initial anchor entity obtained by mapping is used as the starting point for retrieval. The priority direction of neighborhood traversal is determined according to the extracted intent tags. For example, when the intent tag is normative verification, logical paths such as exclusive clauses and scope of application are prioritized; when the intent tag is comparative selection, the applicable condition paths of different schemes are prioritized. A neighborhood traversal with a depth of three hops is performed in the constructed knowledge graph entity library.
[0074] In practical applications, the process begins by retrieving all directly related one-hop neighbor nodes and their relational triples, centered on the initial anchor entity, to obtain standard clause information directly related to the query entity. Then, starting from the one-hop neighbor node, the search continues outwards to retrieve its associated two-hop neighbor nodes, capturing clause content indirectly related to the query entity. Finally, starting from the two-hop neighbor node, the search further retrieves its three-hop neighbor nodes, thus expanding the search scope to deeper logical relationships. Through this layer-by-layer depth-first traversal, all neighbor nodes and their connection triples within the three-hop range of the initial anchor entity are obtained. These nodes and relationships together constitute a structured logical chain reflecting the indirect references, constraints, and subordinate logic between standard clauses. This structured logical chain effectively restores the chain-like reference characteristics present in tunnel surrounding rock standard documents, such as the reference of one clause to another, the constraint of preconditions on subsequent provisions, and the cross-verification relationships between different standard documents. This provides complete topological information for subsequent background completion and conflict verification, overcoming the deficiency of traditional semantic retrieval in capturing cross-document logical relationships.
[0075] In this embodiment, after generating the structured logic chain used to restore the indirect reference logic between standard clauses, the method further includes:
[0076] The knowledge coverage rate is calculated to evaluate the ability of the structured logic chain to reproduce the standard deep logic chain of the tunnel surrounding rock. The calculation formula is as follows:
[0077] ;
[0078] in, Indicates knowledge coverage. This represents the set of entities that form the initial anchor points. This represents the set of entity evidence contained in the standard answers of the industry standard question-answering dataset. This represents the set of three-hop neighbor nodes obtained by performing a three-hop neighborhood traversal centered on the initial anchor entity. This indicates the number of elements in the set.
[0079] Specifically, by calculating the percentage of intersection between the three-hop neighborhood entity set and the standard answer entity evidence set, the extent to which the structured logical chain covers the deep logical connections between standard clauses is quantitatively evaluated. Knowledge Coverage The higher the value, the more completely the structured logic chain obtained through three-hop neighborhood traversal restores the deep logical relationships such as indirect references, constraints, and dependencies existing in the standard file, thereby achieving a quantitative evaluation of the ability to restore the structured logic chain.
[0080] Step 4: Perform high-dimensional vector semantic retrieval:
[0081] The original query statement is transformed into a query feature vector. A nearest neighbor search is performed in the vector index library. The cosine similarity between the query feature vector and the text vectors in the vector index library is calculated. The top-N semantically relevant text fragments with the highest cosine similarity ranking are recalled as unstructured contextual evidence.
[0082] Specifically, while performing multi-hop retrieval of the knowledge graph, high-dimensional vector semantic retrieval is performed in parallel to capture contextual information that is highly relevant to the user query at the semantic level but may not be explicitly modeled in the knowledge graph.
[0083] In practical applications, the user's original query is first transformed into a query feature vector using an embedding model. Then, a nearest neighbor search is performed in the constructed vector index library to calculate the cosine similarity between the query feature vector and the embedding vector corresponding to each standard entry in the vector index library. The closer the cosine similarity value is to 1, the higher the semantic matching degree between the query and the entry. Finally, the similarity scores are sorted in descending order, and the top-N semantically relevant entry fragments are retrieved as unstructured contextual evidence. In this embodiment, N is preferably 3, meaning the three most similar entry fragments are retrieved. This step, through semantic retrieval, effectively supplements semantically relevant evidence that might be missed in knowledge graph retrieval, providing rich unstructured contextual support for subsequent background completion, conflict verification, and evidence fusion.
[0084] In this embodiment, after recalling the Top-N semantically relevant text fragments with the highest cosine similarity ranking, the method further includes:
[0085] Calculate the semantic consistency score, which is used to evaluate the degree of consistency between the Top-N semantically relevant text fragments and the user's true intent. The calculation formula is as follows:
[0086] ;
[0087] in, Indicates semantic consistency score, This indicates the number of semantically relevant text fragments recalled. This represents the query feature vector. Represents the first in the vector index library A vector of recalled text fragments, This represents the preset weight decay coefficient. Denotes the Euclidean norm. Indicates the query feature vector and the first The cosine similarity of the vectors of each clause segment.
[0088] Specifically, through the The cosine similarity of each recalled fragment is weighted and averaged to comprehensively evaluate the semantic matching degree between the overall recall results and the user's query intent. Semantic consistency score. The higher the value, the more accurate the semantic matching between the recalled unstructured text and the user's true intent, thus enabling a quantitative evaluation of the semantic matching quality of the recall results.
[0089] Step 5: Perform a non-linear fusion of structured logic and semantic text:
[0090] The structured logic chain is used to perform background completion and conflict verification on the recalled Top-N semantically relevant text fragments, and the processed text fragments are fused with the structured logic chain to form a fused evidence chain.
[0091] In this embodiment, the structured logic chain is used to perform background completion and conflict verification on the recalled Top-N semantically relevant text fragments, specifically including steps 501 to 505:
[0092] Step 501: Obtain the entities contained in the structured logic chain and the topological structure information between entities;
[0093] Step 502: Extract entities from the Top-N semantically related text fragments to obtain the first entity set;
[0094] Step 503: Compare the first entity set with the entities in the structured logic chain to identify the associated text fragments in the Top-N semantically related text fragments that have entity associations with the structured logic chain, and the isolated text fragments that do not have entity associations with the structured logic chain.
[0095] Step 504: Use the topological information to complete the background of the related clause fragments, and supplement the information on the preconditions, scope of application or exclusive clauses associated with them in the structured logical chain.
[0096] Step 505: Mark the isolated text fragments as noise information and perform noise reduction processing to remove or reduce their weight from the recalled Top-N semantically relevant text fragments.
[0097] In practical applications, firstly, all entities and their topological information are extracted from the generated structured logical chain. This topological information reflects the deep logical relationships between standard clauses, such as preconditions, scope of application, and exclusive clauses. Simultaneously, entity extraction is performed on the recalled Top-N semantically relevant clause fragments to obtain the first entity set.
[0098] Then, the first entity set is compared one by one with the entities in the structured logical chain. Based on the entity association, the Top-N semantically related text fragments are divided into two categories: one category is related text fragments that have entity associations with the structured logical chain. These fragments are semantically related to the user query and can be corroborated by the structured evidence in the knowledge graph; the other category is isolated text fragments that do not have entity associations with the structured logical chain. Although these fragments have high semantic similarity, they lack logical support between standard texts and belong to potential noise information.
[0099] Finally, for the identified related clause fragments, topological structure information is used to complete their background. This involves supplementing the original clause content with information about its associated preconditions, scope of application, or exclusive clauses within the structured logical chain, thus integrating isolated clause fragments into a complete logical context and overcoming the shortcomings of broken logical chains in traditional semantic retrieval. Identified isolated clause fragments are marked as noise and denoised, then removed from the recalled Top-N semantically relevant clause fragments or have their weight reduced, effectively solving the problem of information redundancy and noisy nodes introduced by knowledge graph retrieval. Through these steps, a deep fusion of structured logical chains and unstructured contextual evidence is achieved, providing high-quality input for subsequent evidence fusion and compliance constraints.
[0100] In this embodiment, the processed text fragments are fused with the structured logic chain, specifically including steps 511 to 514:
[0101] Step 511: Determine the second entity set of the initial anchor entity in the structured logic chain, and the third entity set of the initial anchor entity in the processed text fragment;
[0102] Step 512: Calculate the entity overlap degree between the second entity set and the third entity set. The entity overlap degree is used to characterize the degree of association between the structured logic chain and the processed text fragment at the entity level.
[0103] Step 513: Reorder the processed text fragments according to the entity overlap degree, wherein the text fragments with higher entity overlap degree have higher weight in the reordering.
[0104] Step 514: Merge the reordered text fragments with the structured logic chain.
[0105] In practical applications, firstly, the entities associated with the initial anchor entity in the structured logic chain are determined to form the second entity set. At the same time, the entities associated with the initial anchor entity in the text fragments after background completion and denoising are determined to form the third entity set.
[0106] Then, the entity overlap degree between the second entity set and the third entity set is calculated. The entity overlap degree is used to quantify the degree of association between the structured logic chain and the processed text fragment at the entity level. The higher the entity overlap degree, the stronger the consistency between the processed text fragment and the structured logic chain at the entity level.
[0107] Next, the processed text fragments are reordered based on the degree of entity overlap. Text fragments with higher entity overlap have higher weight in the reordering, meaning they are ranked earlier. This process ensures that text fragments more closely associated with the structured logic chain receive higher priority.
[0108] Finally, the reordered text fragments are integrated with the structured logical chain to form a complete fused evidence chain.
[0109] Through the above fusion steps, the deep integration of knowledge graph topology information and semantic retrieval results is effectively achieved. This results in the final fusion evidence chain, which includes both the standard indirect reference logic provided by the structured logic chain and the unstructured semantic evidence that has been filtered and sorted. This provides a comprehensive and authoritative input basis for subsequent compliance constraints and response generation.
[0110] Step 6: Enforce compliance constraints:
[0111] Based on the standard paradigm in the industry standard question-and-answer dataset and the intent tags, the fused evidence chain is subject to compliance constraints to generate a final answer that matches the user's intent and has textual source evidence.
[0112] In this embodiment, compliance constraints are applied to the fused evidence chain, specifically including steps 601 to 604:
[0113] Step 601: Compare the fused evidence chain with the standard paradigm in the industry standard question-and-answer dataset, select the standard paradigm that matches the user's intent based on the intent label, and identify the evidence entries in the fused evidence chain that match the standard paradigm.
[0114] Step 602: Based on the wording format, logical structure, and terminology specifications stipulated in the standard paradigm, apply compliance constraints to the fused evidence chain and adjust it to a standardized expression that conforms to the industry standard question-and-answer pair dataset central standard paradigm.
[0115] Step 603: Generate traceability information, including the source of the clause, clause number, and citation relationship, from the fused evidence chain after compliance constraints, according to the evidence citation presentation method in the standard paradigm;
[0116] Step 604: Based on the standardized expression and traceability information, generate a final answer that matches the user's intent and has textual traceability basis.
[0117] In practical applications, firstly, the fused evidence chain is compared one by one with the standard paradigms in the constructed industry standard question-and-answer dataset. Then, based on the extracted intent tags, the standard paradigm that matches the user's intent is selected (e.g., for normative verification intent, the paradigm that includes the judgment of exclusive clauses is selected; for comparative selection intent, the paradigm that includes the structure of comparison of advantages and disadvantages is selected). The evidence items in the fused evidence chain that match the standard paradigm are identified. The standard paradigm includes the wording format that conforms to industry norms, a rigorous logical structure, and unified terminology.
[0118] Then, based on the intent tags and the wording format, logical structure, and terminology specifications stipulated in the standard paradigm, the fused evidence chain is subject to compliance constraints. It is adjusted to a standardized expression that conforms to the user's intent and the industry standard question-and-answer pair dataset centralized standard paradigm, ensuring that the final answer is highly consistent with the authoritative standard documents in terms of language expression.
[0119] Then, the fused evidence chain, after compliance constraints, is presented in accordance with the evidence citation presentation method in the standard paradigm to generate traceability information including the source of the provision (such as the name of the standard document), the provision number (such as the specific chapter and provision number), and the citation relationship (such as a provision citing or constraining another provision), so that every information point in the answer can be traced back to the official authoritative provisions.
[0120] Finally, based on standardized expressions and source information, a final answer is generated that matches the user's intent and has source evidence.
[0121] Through the aforementioned compliance constraints and traceability information generation steps, this embodiment suppresses the possibility of large language models generating illusory content from the source, ensuring the rigor, authority, and auditability of the answers, and providing reliable technical support for standard question answering in high-risk engineering scenarios.
[0122] In this embodiment, after generating the final answer with supporting textual evidence, the method further includes:
[0123] The comprehensive evaluation index is calculated to measure the overall retrieval accuracy. The calculation formula is as follows:
[0124] ;
[0125] in, This represents the comprehensive evaluation indicators. Indicates knowledge coverage. This represents the semantic consistency score.
[0126] Specifically, comprehensive evaluation indicators The harmonic mean is used to comprehensively reflect the overall performance in terms of both logical completeness and semantic matching. (Comprehensive evaluation index) A higher value indicates that while restoring the deep logical connections between standard clauses, it can accurately match the user's query intent, achieving an effective integration of structured logic and semantic similarity. Through comprehensive evaluation metrics, a quantitative assessment of the overall performance of the question-answering system is achieved.
[0127] In this embodiment, the knowledge coverage will ultimately be... Semantic consistency score With comprehensive evaluation indicators The results are output along with the final Q&A, helping developers identify potential problems at each stage and make targeted optimizations. For example, regarding knowledge coverage... A low score indicates that a three-hop neighborhood traversal failed to adequately capture the indirect reference logic between standard clauses, potentially requiring optimization of the entity relationship construction quality of the knowledge graph or adjustment of the graph retrieval strategy; if the semantic consistency score is low... A low score indicates that vector semantic retrieval failed to accurately match user intent, which may require optimization of the embedding model, adjustment of recall, or improvement of weight decay coefficient settings; if the comprehensive evaluation metrics are considered... If the results are unsatisfactory, a comprehensive evaluation of the synergistic effect of the dual-path retrieval needs to be conducted, and the fusion strategy should be adjusted accordingly. By continuously monitoring these three metrics, closed-loop optimization can be achieved, continuously improving the quality of question answering.
[0128] In summary, the tunnel surrounding rock question-answering method integrating knowledge graphs and semantic retrieval provided in this embodiment provides a traceable and authoritative data foundation for standard questions and answers on tunnel surrounding rock by constructing a knowledge graph entity library containing entity relationship chains, an industry standard question-answer pair dataset, and a vector index library. Based on this, a three-hop neighborhood traversal is performed centered on the initial anchor entity extracted by the user query to generate a structured logical chain that restores the indirect reference logic between standard clauses, effectively solving the defects of broken logical chains and difficulty in capturing cross-document reference relationships in existing technologies. Simultaneously, vector semantic retrieval is performed in parallel to recall Top-N semantically relevant clause fragments as unstructured contextual evidence. Furthermore, structured evidence is achieved through entity comparison, topological information background completion, and isolated fragment denoising. The deep integration of logical and semantic similarity overcomes the imbalance between intent matching and factual association in single retrieval methods. The processed text fragments are then fused with structured logical chains to form a fused evidence chain. Furthermore, compliance constraints are applied to the standard paradigms and intent tags in the dataset based on industry-standard question-and-answer principles, generating source information including text origin, clause number, and citation relationships. Finally, an authoritative answer that matches the user's intent and has source evidence is output, suppressing the knowledge illusion generated by large language models from the source and providing trustworthy and auditable technical support for high-risk engineering scenarios. In addition, this embodiment can adopt a lightweight plug-in architecture, eliminating the need for expensive full-parameter fine-tuning of the underlying large language model, offering significant advantages such as user-friendly deployment, rapid response, and low engineering implementation costs.
[0129] Based on the above technical solutions, this embodiment also proposes a tunnel surrounding rock question-answering system that integrates knowledge graphs and semantic retrieval, used to implement the tunnel surrounding rock question-answering method that integrates knowledge graphs and semantic retrieval as described in the embodiment. Please refer to [link to relevant documentation]. Figure 2 The system includes:
[0130] The database construction module is used to perform structured parsing of collected tunnel surrounding rock standard documents and industry specification documents, extract the main text of the clauses and the constraints, references and subordinate relationships between the clauses, and build an industry standard question and answer pair dataset and a corresponding vector index library based on this, and generate a knowledge graph entity library containing entity relationship chains;
[0131] The multidimensional entity extraction module is used to receive the original query statement input by the user, call the pre-trained large language model interface, identify and extract key entities and intent tags from the original query statement, and map the key entities to the knowledge graph entity library as initial anchor entities.
[0132] The dual-path joint recall module is used to perform a three-hop neighborhood traversal in the knowledge graph entity database centered on the initial anchor entity, and determine the priority direction of the neighborhood traversal according to the intent tag, obtain the three-hop neighbor nodes and relation triples of the initial anchor entity, and generate a structured logical chain for reconstructing the indirect reference logic between standard clauses; the original query statement is transformed into a query feature vector, a nearest neighbor search is performed in the vector index database, the cosine similarity between the query feature vector and the clause vector in the vector index database is calculated, and the top-N semantically relevant clause fragments with the highest cosine similarity ranking are recalled as unstructured contextual evidence;
[0133] The knowledge conflict verification module is used to perform background completion and conflict verification on the recalled Top-N semantically related text fragments using the structured logic chain, and to fuse the processed text fragments with the structured logic chain to form a fused evidence chain;
[0134] The enhanced answer generation module is used to apply compliance constraints to the fused evidence chain based on the standard paradigm in the industry standard question and answer dataset and the intent tags, and generate a final answer that matches the user's intent and has textual source evidence.
[0135] It is understood that the tunnel surrounding rock question answering system that integrates knowledge graph and semantic retrieval described in this embodiment is a system for implementing the tunnel surrounding rock question answering method that integrates knowledge graph and semantic retrieval described in the embodiment. As the system disclosed in the embodiment corresponds to the method disclosed in the embodiment, the description is relatively simple. For relevant parts, please refer to the description of the method. It will not be repeated here.
Claims
1. A question-and-answer method for tunnel surrounding rock integrating knowledge graph and semantic retrieval, characterized in that, The method includes: The collected standard documents and industry specification documents for tunnel surrounding rock are structured and parsed to extract the main text of the clauses and the constraints, references and subordinate relationships between the clauses. Based on this, an industry standard question and answer pair dataset and a corresponding vector index library are constructed, and a knowledge graph entity library containing entity relationship chains is generated. The system receives the user's original query statement, calls the pre-trained large language model interface, identifies and extracts key entities and intent tags from the original query statement, and maps the key entities to the knowledge graph entity library as initial anchor entities. Centered on the initial anchor entity, a three-hop neighborhood traversal is performed in the knowledge graph entity library, and the priority direction of the neighborhood traversal is determined according to the intent tag. The three-hop neighbor nodes and relation triples of the initial anchor entity are obtained, and a structured logic chain for restoring the indirect reference logic between standard clauses is generated. The original query statement is transformed into a query feature vector. Nearest neighbor search is performed in the vector index library. The cosine similarity between the query feature vector and the text vector in the vector index library is calculated. The top-N semantically relevant text fragments with the highest cosine similarity ranking are recalled as unstructured contextual evidence. The structured logic chain is used to perform background completion and conflict verification on the recalled Top-N semantically relevant text fragments, and the processed text fragments are fused with the structured logic chain to form a fused evidence chain; Based on the standard paradigm in the industry standard question-and-answer dataset and the intent tags, the fused evidence chain is subject to compliance constraints to generate a final answer that matches the user's intent and has textual source evidence.
2. The tunnel surrounding rock question-answering method integrating knowledge graph and semantic retrieval according to claim 1, characterized in that, After generating the structured logic chain used to reconstruct the indirect reference logic between standard clauses, the following is also included: The knowledge coverage rate is calculated and output along with the final question and answer. This rate is used to evaluate the ability of the structured logic chain to reconstruct the standard deep logic chain of the tunnel surrounding rock. The calculation formula is as follows: ; in, Indicates knowledge coverage. This represents the set of entities that form the initial anchor points. This represents the set of entity evidence contained in the standard answers of the industry standard question-answering dataset. This represents the set of three-hop neighbor nodes obtained by performing a three-hop neighborhood traversal centered on the initial anchor entity. This indicates the number of elements in the set.
3. The tunnel surrounding rock question-answering method integrating knowledge graph and semantic retrieval according to claim 1, characterized in that, After recalling the top-N semantically relevant text fragments with the highest cosine similarity ranking, the following were also included: A semantic consistency score is calculated and output along with the final question and answer. This score evaluates the degree to which the Top-N semantically relevant text fragments match the user's true intent. The calculation formula is as follows: ; in, Indicates semantic consistency score, This indicates the number of semantically relevant text fragments recalled. This represents the query feature vector. Represents the first in the vector index library A vector of recalled text fragments, This represents the preset weight decay coefficient. Denotes the Euclidean norm. Indicates the query feature vector and the first The cosine similarity of the vectors of each clause segment.
4. The tunnel surrounding rock question-answering method integrating knowledge graph and semantic retrieval according to claim 1, characterized in that, After generating the final answer with supporting textual evidence, it also includes: Calculate the comprehensive evaluation index and output it along with the final question and answer. The comprehensive evaluation index is used to measure the overall retrieval accuracy, and its calculation formula is as follows: ; in, This represents the comprehensive evaluation indicators. Indicates knowledge coverage. This represents the semantic consistency score.
5. The tunnel surrounding rock question-answering method integrating knowledge graph and semantic retrieval according to claim 1, characterized in that, The pre-trained large language model interface identifies core business entities and technical indicator keywords from the original query statement by designing targeted prompt words as the key entities, and identifies intent tags from the original query statement.
6. The tunnel surrounding rock question-answering method integrating knowledge graph and semantic retrieval according to claim 1, characterized in that, Centered on the initial anchor entity, a neighborhood traversal with a depth of three hops is performed in the knowledge graph entity database, specifically including: Starting from the initial anchor point entity, the priority traversal direction is determined according to the intent tag. All its directly associated one-hop neighbor nodes are traversed. Then, starting from the one-hop neighbor node, its associated two-hop neighbor nodes are traversed. Finally, starting from the two-hop neighbor node, its associated three-hop neighbor nodes are traversed to restore the indirect reference logic between standard clauses.
7. The tunnel surrounding rock question-answering method integrating knowledge graph and semantic retrieval according to claim 1, characterized in that, The structured logic chain is used to perform background completion and conflict verification on the recalled Top-N semantically relevant text fragments, specifically including: Obtain the entities contained in the structured logic chain and the topological structure information between entities; Entity extraction is performed on the Top-N semantically related text fragments to obtain the first entity set; The first entity set is compared with the entities in the structured logic chain to identify the associated text fragments in the Top-N semantically related text fragments that have entity association with the structured logic chain, as well as the isolated text fragments that do not have entity association with the structured logic chain. The topological information is used to complete the background of related clause fragments, supplementing them with information on preconditions, scope of application, or exclusive clauses associated with them in the structured logical chain; The isolated text fragments are marked as noise information and denoised, and then removed or have their weight reduced from the recalled Top-N semantically relevant text fragments.
8. The tunnel surrounding rock question-answering method integrating knowledge graph and semantic retrieval according to claim 1, characterized in that, The processed text fragments are then integrated with the structured logic chain, specifically including: Determine the second set of entities of the initial anchor entity in the structured logic chain, and the third set of entities of the initial anchor entity in the processed text fragment; Calculate the entity overlap degree between the second entity set and the third entity set. The entity overlap degree is used to characterize the degree of association between the structured logic chain and the processed text fragment at the entity level. The processed text fragments are reordered based on the entity overlap degree, wherein the text fragments with higher entity overlap degree have higher weight in the reordering. The reordered text fragments are then merged with the structured logic chain.
9. The tunnel surrounding rock question-answering method integrating knowledge graph and semantic retrieval according to claim 1, characterized in that, Compliance constraints are imposed on the fusion of evidence chains, specifically including: The fused evidence chain is compared with the standard paradigm in the industry standard question-and-answer dataset. Based on the intent label, the standard paradigm that matches the user intent is selected, and the evidence entries in the fused evidence chain that match the standard paradigm are identified. Based on the wording format, logical structure, and terminology specifications stipulated in the standard paradigm, the fused evidence chain is subject to compliance constraints, and is adjusted to a standardized expression that conforms to the industry standard question-and-answer pair dataset central standard paradigm. The fused evidence chain, after compliance constraints, is used to generate traceability information, including the source of the clause, clause number, and citation relationship, in accordance with the evidence citation presentation method in the standard paradigm. Based on the standardized expression and traceability information, a final answer that matches the user's intent and has textual traceability is generated.
10. A tunnel surrounding rock question-and-answer system integrating knowledge graphs and semantic retrieval, characterized in that, The system is used to implement the tunnel surrounding rock question-answering method that integrates knowledge graph and semantic retrieval as described in any one of claims 1 to 9, the system comprising: The database construction module is used to perform structured parsing of collected tunnel surrounding rock standard documents and industry specification documents, extract the main text of the clauses and the constraints, references and subordinate relationships between the clauses, and build an industry standard question and answer pair dataset and a corresponding vector index library based on this, and generate a knowledge graph entity library containing entity relationship chains; The multidimensional entity extraction module is used to receive the original query statement input by the user, call the pre-trained large language model interface, identify and extract key entities and intent tags from the original query statement, and map the key entities to the knowledge graph entity library as initial anchor entities. The dual-path joint recall module is used to perform a three-hop neighborhood traversal in the knowledge graph entity database centered on the initial anchor entity, and determine the priority direction of the neighborhood traversal according to the intent tag, obtain the three-hop neighbor nodes and relation triples of the initial anchor entity, and generate a structured logical chain for reconstructing the indirect reference logic between standard clauses; the original query statement is transformed into a query feature vector, a nearest neighbor search is performed in the vector index database, the cosine similarity between the query feature vector and the clause vector in the vector index database is calculated, and the top-N semantically relevant clause fragments with the highest cosine similarity ranking are recalled as unstructured contextual evidence; The knowledge conflict verification module is used to perform background completion and conflict verification on the recalled Top-N semantically related text fragments using the structured logic chain, and to fuse the processed text fragments with the structured logic chain to form a fused evidence chain; The enhanced answer generation module is used to apply compliance constraints to the fused evidence chain based on the standard paradigm in the industry standard question and answer dataset and the intent tags, and generate a final answer that matches the user's intent and has textual source evidence.