Electric power safety regulation cross-text retrieval method and system based on graph retrieval
By constructing a knowledge dataset of power safety regulations and integrating entity relationship graphs and intra-sentence co-occurrence hypergraphs, filtering evidence subgraphs and using graph neural network encoding, the problem of incomplete answer reasoning chains in power safety regulations was solved, achieving efficient and accurate multi-hop question answering.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-30
- Publication Date
- 2026-03-31
AI Technical Summary
Existing technologies struggle to effectively capture semantic relationships across clauses and paragraphs when processing power safety regulations, resulting in fragmented retrieved knowledge information and incomplete reasoning chains for generated answers that lack logical coherence.
By constructing a knowledge dataset of power safety regulations, an entity relationship graph and a sentence co-occurrence hypergraph are generated and fused into a fusion graph matrix. The information-path collaborative subgraph retrieval algorithm is used to filter evidence subgraphs, and graph neural network encoding features are combined to finally generate answers and reasoning paths in a frozen large language model.
It significantly improves the accuracy and interpretability of multi-hop question answering, ensures the logical coherence and information integrity of the answers, and improves the efficiency and accuracy of power safety regulation queries.
Smart Images

Figure CN121765055A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of large language models and natural language processing technology, and more specifically, to a cross-text retrieval method and system for power safety regulations based on graph retrieval. Background Technology
[0002] As power systems expand and safety regulations become increasingly complex, maintenance, inspection, and management personnel frequently need to quickly and accurately query and understand power safety regulations in their daily work. Traditional question-answering models based on keyword matching or rule templates struggle to handle complex multi-hop reasoning problems, such as "Under what circumstances should power outages and tagging / locking be performed simultaneously?" These cross-document multi-hop question-answering tasks involving multiple regulation clauses are widespread in open-domain question answering, fact-checking, scientific reasoning, and knowledge graph question answering scenarios. Such tasks often require linking multiple pieces of evidence across sentences, paragraphs, and even documents to form a reliable chain of reasoning in order to arrive at a dependable answer.
[0003] In recent years, the application of Retrieval Augmentation (RAG) and graph-based retrieval on large language models has enabled them to perform well in question answering and natural language processing tasks. However, when dealing with knowledge-intensive and logically rigorous tasks such as power safety, the following challenges remain: Single retrieval strategies struggle to capture semantic relationships across clauses and paragraphs, leading to fragmented retrieved power safety regulations and incomplete reasoning chains in the generated answers; existing subgraph retrieval algorithms often focus on semantic similarity while neglecting the logic between semantics, resulting in a lack of logical coherence in the retrieved evidence subgraphs and ultimately, a lack of semantic logic in the final answer. Therefore, a new method is urgently needed to address these issues. Summary of the Invention
[0004] The main objective of this invention is to provide a graph-based cross-text retrieval method and system for power safety regulations, thereby addressing at least the problems of incomplete reasoning chains and semantically confusing answers in existing technologies. This significantly improves the accuracy and interpretability of multi-hop question answering.
[0005] To achieve the above objectives, a cross-text retrieval method and system for power safety regulations based on graph retrieval is provided.
[0006] In a first aspect, the present invention provides a cross-text retrieval method for power safety regulations based on graph retrieval, the method comprising:
[0007] Collect power safety regulations documents, preprocess the power safety regulations documents to construct a power safety regulations knowledge dataset, construct an entity relationship graph and an intra-sentence co-occurrence hypergraph related to the proposed questions based on the power safety regulations knowledge dataset, and align and fuse the entity relationship graph and the intra-sentence co-occurrence hypergraph to obtain a fused graph matrix;
[0008] A token budget constraint is preset, and an information-path collaborative subgraph retrieval algorithm is used to select an evidence subgraph related to the proposed question from the fusion graph matrix based on the token budget constraint.
[0009] The evidence subgraph is encoded using a graph neural network, and the node features, text information features, topological structure features and type features in the evidence subgraph are fused into a feature vector.
[0010] The input data is obtained by concatenating the structured soft cue vector and the text information of the evidence subgraph after freezing all parameters of the large language model. The input data is then processed by the large language model with all parameters frozen to generate the final answer and the corresponding reasoning path.
[0011] Specifically, the power safety regulations documents are preprocessed to construct a power safety regulations knowledge dataset, including:
[0012] Regular rules and PDF text parsing tools are used to perform structured segmentation of the power safety regulations document in order to extract the title and corresponding text content of each clause in the power safety regulations document;
[0013] Based on commonly used punctuation marks, the main text of each clause is segmented into sentences to obtain a set of sentences;
[0014] A large language model is used to generate corresponding simulated questions, simulated answers, and simulated reasoning chains for each statement in the statement set.
[0015] A knowledge dataset of power safety regulations is constructed using multiple statements, simulated questions, simulated answers, and simulated reasoning chains.
[0016] Specifically, based on the power safety regulations knowledge dataset, an entity relationship graph and an intra-sentence co-occurrence hypergraph are constructed related to the proposed questions, including:
[0017] An initial set of relation edges is obtained by extracting the relationships between entities in the power safety regulations knowledge dataset.
[0018] The entity relationship graph is obtained by filtering entities related to the problem from the initial relation edge set and performing multi-hop expansion.
[0019] The weighted adjacency matrix of the entity relationship graph is obtained by filtering the vertices in the vertex set based on their relevance scores and path costs.
[0020] Specifically, the relevance score of vertices in the vertex set is calculated based on the semantic similarity between the question and the entity, and the path cost is calculated based on the strength of the relationship between the entities.
[0021] Specifically, based on the knowledge dataset of power safety regulations, an entity relationship graph and an intra-sentence co-occurrence hypergraph are constructed related to the proposed questions. The entity relationship graph and the intra-sentence co-occurrence hypergraph are aligned and fused to obtain a fused graph matrix, which also includes:
[0022] Each statement in the power safety regulations knowledge dataset is abstracted into a hyperedge, which connects all entities appearing in the statement.
[0023] For each statement, a sentence node representing semantics is created. The sentence node is then connected to all entities in the corresponding statement to obtain multiple sentence chains. These multiple sentence chains form a star-shaped connection structure centered on the sentence node.
[0024] Each sentence chain is assigned a different weight based on its relevance to the question being asked, and the weights together form a weighted adjacency matrix of the sentence co-occurrence hypergraph.
[0025] The weighted adjacency matrix of the entity relationship graph and the weighted adjacency matrix of the intra-sentence co-occurrence hypergraph are linearly fused to obtain the fused graph matrix, which represents the structure of the fused graph.
[0026] Specifically, the weights are determined by the positional weight of the statement in the power safety regulations knowledge dataset, the semantic relevance of the statement to the question, and the content relevance of the entity to the question.
[0027] Specifically, a token budget constraint is preset, and based on this constraint, an information-path collaborative subgraph retrieval algorithm is used to select an evidence subgraph relevant to the proposed question from the fused graph matrix, including:
[0028] The cosine similarity between the vector representation of the proposed problem and the vector representations of all nodes and edges in the fusion graph is calculated to obtain the correlation score of multiple nodes. The k nodes with the highest correlation scores are selected to construct a seed node set.
[0029] Using each seed node in the seed node set as the root, perform a bounded breadth-first search with at most L hops in the fusion graph to generate multiple candidate paths;
[0030] Design a path scoring function, preset a token budget constraint and a path scoring threshold, calculate the path scoring function values of multiple candidate paths based on the token budget constraint, and select candidate paths with path scoring function values higher than the path scoring threshold for complementary splicing to construct an evidence subgraph.
[0031] Specifically, a graph neural network is used to encode the evidence subgraph, fusing node features, textual information features, topological structure features, and type features in the evidence subgraph into a feature vector, including:
[0032] A text encoder is used to convert the text attributes of each node and edge in the evidence subgraph into an initial vector representation;
[0033] A graph neural network is used to perform message passing and feature aggregation on the evidence subgraph to fuse node features, text information features, topological structure features and type features to obtain a feature vector.
[0034] The feature vectors are pooled to generate graph-level vector representations, which serve as semantic summaries of the evidence subgraphs.
[0035] Specifically, all parameters of the large language model are frozen, and the structured soft cue vector and the text information of the evidence subgraph are concatenated to obtain the input data. The large language model with all parameters frozen is then used to process the input data to generate the final answer and the corresponding reasoning path, including:
[0036] While keeping all parameters frozen, a knowledge question-and-answer model for power safety regulations is generated based on Mistral-7B-Instruct.
[0037] The graph-level vector representation is mapped to a structured soft cue vector, and the structured soft cue vector is concatenated with text information to obtain the input data.
[0038] The knowledge question-and-answer model for power safety regulations generates sequential text in an autoregressive manner based on the input data. The sequential text includes the final answer and the corresponding reasoning path.
[0039] Secondly, this invention provides a graph-based cross-text retrieval system for power safety regulations. The system applies the method described in the first part and includes:
[0040] The fusion graph construction unit is used to collect power safety regulations documents, preprocess the power safety regulations documents to construct a power safety regulations knowledge dataset, construct an entity relationship graph and an intra-sentence co-occurrence hypergraph related to the proposed questions based on the power safety regulations knowledge dataset, and align and fuse the entity relationship graph and the intra-sentence co-occurrence hypergraph to obtain a fusion graph matrix.
[0041] The evidence subgraph construction unit is connected to the fusion graph construction unit. The evidence subgraph construction unit is used to preset the token budget constraint. Based on the token budget constraint, the information-path collaborative subgraph retrieval algorithm is used to select an evidence subgraph related to the proposed question from the fusion graph matrix.
[0042] The feature vector extraction unit is connected to the evidence subgraph construction unit. The feature vector extraction unit is used to encode the evidence subgraph using a graph neural network and fuse the node features, text information features, topological structure features and type features in the evidence subgraph into a feature vector.
[0043] The answer and reasoning path generation unit is connected to the feature vector extraction unit. The answer and reasoning path generation unit is used to freeze all parameters of the large language model, concatenate the structured soft cue vector and the text information of the evidence subgraph to obtain the input data, and use the large language model after freezing all parameters to process the input data to generate the final answer and the corresponding reasoning path.
[0044] This application provides a graph retrieval-based cross-text retrieval method and system for power safety regulations. The method first preprocesses the power regulation documents and constructs a knowledge dataset, then combines an entity relationship graph and an intra-sentence co-occurrence hypergraph to generate a fusion graph matrix. Based on this, by pre-setting a token budget constraint, an information-path collaborative subgraph retrieval algorithm is used to select relevant evidence subgraphs from the fusion graph, and a graph neural network is used to encode their node, text, topological, and type features into feature vectors. Finally, under the premise of freezing the parameters of the large language model, the structured soft hint vector is concatenated with the evidence text and input into the model to generate the final answer and the corresponding reasoning path. Attached Figure Description
[0045] The accompanying drawings, which form part of this application, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings:
[0046] Figure 1 A flowchart illustrating a graph-based cross-text retrieval method for power safety regulations provided in this application;
[0047] Figure 2 A schematic diagram of the two-layer graph construction for a cross-text retrieval system for power safety regulations based on graph retrieval provided in this application;
[0048] Figure 3 A schematic diagram of the evidence subgraph retrieval process for a cross-text retrieval method of power safety regulations based on graph retrieval provided in this application;
[0049] Figure 4 A schematic diagram of the subgraph encoding process based on graph neural networks for a graph retrieval method for cross-textual retrieval of power safety regulations provided in this application;
[0050] Figure 5 A flowchart illustrating the answer and reasoning chain generation process of a graph-based cross-text retrieval method for power safety regulations provided in this application;
[0051] Figure 6 This application provides a schematic diagram of the connection of a cross-text retrieval system for power safety regulations based on graph retrieval. Detailed Implementation
[0052] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0053] The terms "first," "second," "third," "fourth," etc. (if present) in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein.
[0054] In this invention, the terms "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described as "exemplary" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0055] This application provides a graph-based method and system for cross-text retrieval of power safety regulations. The method first collects and parses power safety regulation documents to construct a knowledge dataset containing simulated question-and-answer sequences. Then, based on the dataset, it constructs an entity relationship graph and an intra-sentence co-occurrence hypergraph for each question, aligning and fusing them into a unified graph structure. Next, under a pre-defined token budget constraint, an information-path collaborative retrieval algorithm is used to locate and extract key evidence subgraphs from the fused graph. Subsequently, a graph neural network is used to encode this subgraph, fusing its multi-dimensional features to generate a graph-level semantic representation. Finally, this structured representation is used as a soft cue, inputting it along with the text information into a parameter-frozen large language model, driving the model to generate accurate answers and clear reasoning paths.
[0056] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0057] Figure 1 A flowchart illustrating a graph-based cross-text retrieval method for power safety regulations provided in this application is shown below. Figure 1 As shown in this embodiment, a cross-text retrieval method for power safety regulations based on graph retrieval is provided. The method includes:
[0058] Collect power safety regulations documents, preprocess the power safety regulations documents to construct a power safety regulations knowledge dataset, construct an entity relationship graph and an intra-sentence co-occurrence hypergraph related to the proposed questions based on the power safety regulations knowledge dataset, and align and fuse the entity relationship graph and the intra-sentence co-occurrence hypergraph to obtain a fused graph matrix;
[0059] A token budget constraint is preset, and an information-path collaborative subgraph retrieval algorithm is used to select an evidence subgraph related to the proposed question from the fusion graph matrix based on the token budget constraint.
[0060] The evidence subgraph is encoded using a graph neural network, and the node features, text information features, topological structure features and type features in the evidence subgraph are fused into a feature vector.
[0061] The input data is obtained by concatenating the structured soft cue vector and the text information of the evidence subgraph after freezing all parameters of the large language model. The input data is then processed by the large language model with all parameters frozen to generate the final answer and the corresponding reasoning path.
[0062] This application provides a graph retrieval-based cross-text search method for power safety regulations. The method first parses and enhances the power safety regulation documents, constructing a knowledge dataset containing entities, sentences, and simulated question-and-answer sequences. For user-generated questions, the method simultaneously constructs an entity relationship graph depicting the relationships between entities and an intra-sentence co-occurrence hypergraph reflecting the co-occurrence relationships of entities within the same sentence, fusing them into a unified fusion graph matrix. Subsequently, under a pre-defined token budget constraint, an information-path collaborative subgraph retrieval algorithm efficiently selects the most relevant evidence subgraphs from the fusion graph. These evidence subgraphs are encoded via a graph neural network, fusing their rich node, text, topological, and type features into a compact feature vector representation. Finally, this vector is used as a structured soft cue, inputting it along with the original text information into a large language model with frozen parameters, thereby guiding the model to generate accurate final answers and clear reasoning paths.
[0063] This method comprehensively captures explicit cross-sentence relationships and implicit intra-sentence co-occurrence information in power regulations knowledge by fusing a dual-graph structure (entity relationship graph and intra-sentence co-occurrence hypergraph), providing richer context for complex reasoning. The introduction of token budget constraints and collaborative retrieval algorithms enables accurate and efficient location of key evidence within massive amounts of knowledge, balancing retrieval recall and computational cost. Graph neural networks are used to encode evidence subgraphs, achieving deep fusion and semantic abstraction of heterogeneous graph information. Finally, through a strategy of "freezing large model parameters + structured soft hints," the method fully utilizes the powerful generation and reasoning capabilities of large language models while ensuring that the interpretation process is strictly controlled by professional regulatory knowledge, effectively improving the accuracy, reliability, and interpretability of question-and-answer answers.
[0064] Specifically, the power safety regulations documents are preprocessed to construct a power safety regulations knowledge dataset, including:
[0065] Regular rules and PDF text parsing tools are used to perform structured segmentation of the power safety regulations document in order to extract the title and corresponding text content of each clause in the power safety regulations document;
[0066] Based on commonly used punctuation marks, the main text of each clause is segmented into sentences to obtain a set of sentences;
[0067] A large language model is used to generate corresponding simulated questions, simulated answers, and simulated reasoning chains for each statement in the statement set.
[0068] A knowledge dataset of power safety regulations is constructed using multiple statements, simulated questions, simulated answers, and simulated reasoning chains.
[0069] This application provides a graph retrieval-based cross-text search method for power safety regulations. This method utilizes regular rules and PDF parsing tools to structurally segment power safety regulation documents, extracting the titles and body text of clauses. The body text is then segmented into independent sentences based on punctuation, forming a set of original sentences. Furthermore, the method uses a large language model to automatically generate corresponding simulated questions, answers, and reasoning chains for each sentence. These generated simulated questions and answers are combined with the original sentences to ultimately construct a knowledge-intensive power safety regulation knowledge dataset containing diverse reasoning paths.
[0070] This method combines automated tools with intelligent models to achieve efficient and accurate structuring of unstructured procedural documents, significantly reducing the cost of manually building knowledge bases. More importantly, by using large language models to generate simulated question-answering and reasoning chains, it not only effectively expands the scale of the dataset but also injects it with rich question-answer pairs and logical reasoning samples. This provides high-quality training and support data for subsequent model learning of complex multi-hop reasoning, enhancing the integrity and usability of the knowledge system.
[0071] Specifically, based on the power safety regulations knowledge dataset, an entity relationship graph and an intra-sentence co-occurrence hypergraph are constructed related to the proposed questions, including:
[0072] An initial set of relation edges is obtained by extracting the relationships between entities in the power safety regulations knowledge dataset.
[0073] The entity relationship graph is obtained by filtering entities related to the problem from the initial relation edge set and performing multi-hop expansion.
[0074] The weighted adjacency matrix of the entity relationship graph is obtained by filtering the vertices in the vertex set based on their relevance scores and path costs.
[0075] This application provides a graph retrieval-based cross-text search method for power safety regulations. The method first extracts the relationships between entities from a knowledge dataset, forming an initial set of relational edges. Then, based on this set, entities semantically relevant to the proposed question are selected, and new related entities are continuously discovered through a multi-hop expansion mechanism, gradually constructing the vertex and edge sets of the entity relationship graph. Finally, the graph is filtered and weighted by combining the semantic similarity (relevance score) of each vertex to the question and the relationship strength (path cost) between connected entities, thereby generating a concise yet crucial weighted adjacency matrix for the entity relationship graph.
[0076] The set of statements is .
[0077] Using entities as vertices An initial set of relation edges is obtained based on relation extraction. , Similarity normalization yields a set of entities relevant to the question. Multi-hop expansion of the seed yields the vertex set. Sum of edges The calculation formula is:
[0078] ;
[0079] ;
[0080] Low-quality edges are filtered out using path cost and vertex relevance scores to obtain a weighted entity relation adjacency matrix. Its definition is as follows:
[0081] ;
[0082] ;
[0083] The advantage of this method lies in its dynamic construction and selective focusing capabilities. Instead of statically using the entire knowledge graph, it actively explores and discovers relevant entities and paths through multi-hop expansion around a specific problem, ensuring the relevance and completeness of the graph construction. The introduction of filtering and weighting mechanisms based on semantic relevance and relationship strength effectively filters out noise and highlights core evidence, making the generated entity relationship graph more refined and interpretable, providing a high-quality and highly relevant network of relationship evidence for subsequent multi-hop reasoning.
[0084] Specifically, the relevance score of vertices in the vertex set is calculated based on the semantic similarity between the question and the entity, and the path cost is calculated based on the strength of the relationship between the entities.
[0085] This application provides a graph retrieval-based cross-text search method for power safety regulations. This method determines the relevance score of vertices by calculating the semantic similarity between the question and the entity, thereby assessing the direct contribution of the entity to answering the current question. Simultaneously, it utilizes the strength of predefined or learned inter-entity relationships in the knowledge base to measure path cost, thus evaluating the difficulty or reliability of inference between different entities. These two metrics work synergistically to guide the construction and optimization of the graph structure.
[0086] This method considers both content relevance and logical connectivity. Semantic similarity ensures that retrieved entities are highly relevant to the question, improving the accuracy of the answer. Relationship strength optimizes the reasoning path, making the model tend to select closely related and logically sound chains of evidence, thereby enhancing the robustness and interpretability of complex multi-hop reasoning and effectively avoiding ineffective diffusion on irrelevant or weakly related paths.
[0087] Specifically, based on the knowledge dataset of power safety regulations, an entity relationship graph and an intra-sentence co-occurrence hypergraph are constructed related to the proposed questions. The entity relationship graph and the intra-sentence co-occurrence hypergraph are aligned and fused to obtain a fused graph matrix, which also includes:
[0088] Each statement in the power safety regulations knowledge dataset is abstracted into a hyperedge, which connects all entities appearing in the statement.
[0089] For each statement, a sentence node representing semantics is created. The sentence node is then connected to all entities in the corresponding statement to obtain multiple sentence chains. These multiple sentence chains form a star-shaped connection structure centered on the sentence node.
[0090] Each sentence chain is assigned a different weight based on its relevance to the question being asked, and the weights together form a weighted adjacency matrix of the sentence co-occurrence hypergraph.
[0091] The weighted adjacency matrix of the entity relationship graph and the weighted adjacency matrix of the intra-sentence co-occurrence hypergraph are linearly fused to obtain the fused graph matrix, which represents the structure of the fused graph.
[0092] This application provides a graph-based cross-text retrieval method for power safety regulations. The method first abstracts each statement in the knowledge dataset as a "hyperedge" connecting all appearing entities, and creates a central "sentence node" for each statement. By connecting the sentence node to each entity within the sentence, a star-shaped sentence chain structure is formed. Next, each sentence chain is weighted according to its relevance to the question, constructing a weighted adjacency matrix of the intra-sentence co-occurrence hypergraph. Finally, this matrix is linearly fused with the weighted adjacency matrix of the entity relationship graph to form a unified fused graph matrix, thereby comprehensively representing the structure of the knowledge.
[0093] like Figure 2 The diagram shown is a schematic diagram of the two-layer graph construction of a cross-text retrieval system for power safety regulations based on graph retrieval provided in this application.
[0094] Each statement Corresponding to a super edge The hyperedge connects all entities that appear within the same statement. A sentence node is introduced for each statement. Then connect the sentence node to all entity nodes within the sentence, and set the edge weight to... The weighted adjacency matrix of the co-occurrence hypergraph within the sentence is obtained. .
[0095] Linearly merge the adjacency matrices obtained from the two graph construction paths to obtain the matrix. Linear fusion is represented as:
[0096]
[0097] Where λ is the fusion coefficient.
[0098] This innovative method models semantic units (sentences) of text as "hyperedges" connecting entities and central nodes, effectively capturing the co-occurrence relationships of entities within the same context and overcoming the shortcomings of traditional entity relationship graphs in expressing close intra-sentence connections. By weightedly fusing two graph structures, it can utilize explicit relationships between entities for long-range inference and strengthen local semantic connections through intra-sentence co-occurrence, providing richer and more accurate contextual and evidentiary support for multi-hop question answering, significantly improving the completeness of knowledge representation and the accuracy of reasoning.
[0099] Specifically, the weights are determined by the positional weight of the statement in the power safety regulations knowledge dataset, the semantic relevance of the statement to the question, and the content relevance of the entity to the question.
[0100] This application provides a cross-text retrieval method for power safety regulations based on graph retrieval. This method assigns weights to each connection in the co-occurrence hypergraph within a sentence. Its calculation comprehensively considers three key factors: the positional weight of the sentence in the document structure (such as the importance of the chapter), the semantic relevance of the sentence to the user's question, and the number of entities contained in the sentence, thereby forming a multi-dimensional and quantitative evaluation index.
[0101] The formula for calculating the weight is:
[0102]
[0103] in, Indicates sentence nodes in the supergraph of co-occurrence within sentences. The weight of each connected sentence chain (i.e., the edge between a statement and an entity), Indicates the question asked With statement The one-to-one correlation between them was calculated using the TF-IDF weighted method. Indicates the superedge The number of entity nodes connected, i.e., the number of statements The total number of entities appearing in Represents the vector of the questions raised. With entity vector The sum of the cosine similarities between them This represents a fusion coefficient used to balance the weights between the TF-IDF term and the entity similarity term.
[0104] This method achieves a refined evaluation of the evidentiary value of statements by integrating three types of features: structural, semantic, and information density. Positional weights incorporate domain prior knowledge, semantic relevance ensures focused answers, and entity count reflects the density of information. This comprehensive evaluation mechanism can more accurately filter out key evidence that is authoritative (positional), relevant (semantic), and information-rich (entity count), effectively improving the quality of evidence for subsequent reasoning and the accuracy of multi-hop question answering.
[0105] Specifically, a token budget constraint is preset, and based on this constraint, an information-path collaborative subgraph retrieval algorithm is used to select an evidence subgraph relevant to the proposed question from the fused graph matrix, including:
[0106] The cosine similarity between the vector representation of the proposed problem and the vector representations of all nodes and edges in the fusion graph is calculated to obtain the correlation score of multiple nodes. The k nodes with the highest correlation scores are selected to construct a seed node set.
[0107] Using each seed node in the seed node set as the root, perform a bounded breadth-first search with at most L hops in the fusion graph to generate multiple candidate paths;
[0108] Design a path scoring function, preset a token budget constraint and a path scoring threshold, calculate the path scoring function values of multiple candidate paths based on the token budget constraint, and select candidate paths with path scoring function values higher than the path scoring threshold for complementary splicing to construct an evidence subgraph.
[0109] This application provides a graph-based cross-text retrieval method for power safety regulations. The method first calculates the similarity between the question vector and all nodes and edges in the fused graph, selecting the k nodes with the highest relevance as a seed set. Then, starting from each seed node, a bounded breadth-first search is performed in the fused graph to explore and collect multiple candidate reasoning paths. Finally, under this budget constraint, an iterative selection strategy is used to construct an evidence subgraph from the candidate paths that is both information-rich and meets the length limit.
[0110] Relevance scoring and seed node selection are performed on the problem vector. Node and edge representation in the fusion graph Calculate the cosine similarity to obtain and Before selection Select the highest-scoring node as the seed node.
[0111] Using each seed node as the root, perform a breadth-first search to expand the path by at most L hops, thus obtaining a restricted path. .
[0112] For a single path, the raw score is calculated and represented as follows:
[0113]
[0114] in , These represent the average correlation between nodes and edges on the path. , The similarity weights for nodes and edges are respectively assigned; then, a joint selection based on information density and path forest is performed, and within the token budget, among the aforementioned candidate paths... The high-density, highly complementary paths are selected, and the calculation formula is expressed as follows:
[0115]
[0116] in, Density temperature, This represents the proportion of new nodes and edges in the newly added path relative to the nodes and edges in the currently selected path. This indicates the level of reward for new nodes and edges.
[0117] Finally, until the budget tokens are exhausted, the selected paths are merged into connected subgraphs and their text descriptions and structures are output for subsequent encoding and generation.
[0118] like Figure 3 The diagram shown is a flowchart illustrating the evidence subgraph retrieval process of a cross-text retrieval method for power safety regulations based on graph retrieval provided in this application.
[0119] This method achieves a balance between retrieval accuracy and computational efficiency through a three-stage mechanism: semantic initial screening, path expansion, and budget-constrained iterative selection. Seed node selection ensures high relevance of the retrieval starting point, bounded breadth search guarantees the integrity and multi-hop nature of the evidence chain, and the token-budget-based iterative selection directly optimizes for the input constraints of the large language model, ensuring that the final submitted evidence subgraph has the highest information density and lowest redundancy. This provides the most effective contextual support for the large language model to generate accurate and concise answers.
[0120] Specifically, a graph neural network is used to encode the evidence subgraph, fusing node features, textual information features, topological structure features, and type features in the evidence subgraph into a feature vector, including:
[0121] A text encoder is used to convert the text attributes of each node and edge in the evidence subgraph into an initial vector representation;
[0122] A graph neural network is used to perform message passing and feature aggregation on the evidence subgraph to fuse node features, text information features, topological structure features and type features to obtain a feature vector.
[0123] The feature vectors are pooled to generate graph-level vector representations, which serve as semantic summaries of the evidence subgraphs.
[0124] This application provides a cross-text retrieval method for power safety regulations based on graph retrieval. The method uses a text encoder to convert the text attributes of all nodes and edges in the evidence subgraph into initial vectors. Then, through the message passing mechanism of the graph neural network, the topological structure between nodes, the type features of nodes and edges, and the initial text representation are iteratively aggregated and fused in multiple rounds. Finally, a concise graph-level vector representation is generated through pooling operations, which serves as a comprehensive semantic summary of the entire evidence subgraph.
[0125] like Figure 4 The diagram shown is a schematic representation of the subgraph encoding process based on a graph neural network in a cross-text retrieval method for power safety regulations based on graph retrieval provided in this application.
[0126] Use a text encoder to retrieve the evidence subgraph The encoding is used as an initial vector. A multi-layer graph attention network is employed to encode the evidence subgraph. For node i, the attention coefficient between it and its neighbor node j is calculated as follows:
[0127]
[0128] in, To perform softmax normalization on neighboring nodes, For the activation function of a linear rectifier unit with leakage, For the parameter vector of the attention mechanism, Let be a linear transformation matrix, and then... The neighbor information is weighted, summed, and nonlinearly transformed to obtain the feature representation of node i at layer l. .
[0129] After stacking L layers of GAT, the final feature representation of all nodes is obtained. Perform a global average pooling operation on it to obtain a graph-level representation vector. This serves as a summary of the evidence subgraph. The graph vector representation is used as a soft cue, input into a large language model to generate answers and reasoning paths.
[0130] This method enables deep and unified encoding of heterogeneous and complex evidence subgraphs. The message passing mechanism of graph neural networks can naturally integrate local node information with global topological structure, capturing multi-hop relationships and long-distance dependencies; unified text encoding ensures the consistency of semantic information. The resulting graph-level vectors not only encapsulate the multi-dimensional information (text, structure, type) of all key evidence, but also form a compact semantic summary, providing an ideal structured input for efficient and accurate interaction with large language models.
[0131] Specifically, all parameters of the large language model are frozen, and the structured soft cue vector and the text information of the evidence subgraph are concatenated to obtain the input data. The large language model with all parameters frozen is then used to process the input data to generate the final answer and the corresponding reasoning path, including:
[0132] While keeping all parameters frozen, a knowledge question-and-answer model for power safety regulations is generated based on Mistral-7B-Instruct.
[0133] The graph-level vector representation is mapped to a structured soft cue vector, and the structured soft cue vector is concatenated with text information to obtain the input data.
[0134] The knowledge question-and-answer model for power safety regulations generates sequential text in an autoregressive manner based on the input data. The sequential text includes the final answer and the corresponding reasoning path.
[0135] This application provides a graph retrieval-based cross-text retrieval method for power safety regulations. This method constructs a question-answering system based on a fully parameter-frozen Mistral-7B-Instruct model. The graph-level vectors obtained by encoding evidence subgraphs through a graph neural network are further mapped into a structured soft-hint vector. This soft-hint vector is concatenated with the original evidence text information to form complete model input data, driving a frozen large language model to generate a sequence of text containing the final answer and its detailed reasoning path in an autoregressive manner.
[0136] like Figure 5 The diagram shown is a flowchart illustrating the process of generating the answer and reasoning chain for a graph-based cross-text retrieval method for power safety regulations provided in this application.
[0137] We use the open-source large language model Mistral-7B-Instruct as the base generative model and keep its parameters frozen. We represent graphs using vectors. Then, use an MLP layer to map to a graph hint vector of the same dimension as the LLM embedding. Constructing a textual context: subgraph The nodes and edges are transcribed into concise node and edge tables as textual subgraph information. , and instruction-based problem template These are concatenated to form the model context, which serves as input to the large language model. The final model then adapts to the conditions... Perform autoregression generation and output the final answer and a brief reasoning process.
[0138] This method freezes all parameters of the large language model, fully preserving its original powerful language understanding and generation capabilities, while avoiding the high computational cost and potential catastrophic forgetting risk associated with fine-tuning all parameters for specific domains. Using graph-level vectors as structured soft cues efficiently and accurately "injects" complex subgraph semantics and relational logic into the model context, thereby precisely guiding the model to reason and generate strictly based on provided professional evidence. This significantly improves the accuracy, reliability, and interpretability of the answers, and ensures that the answers strictly adhere to power safety regulations.
[0139] Figure 6 A schematic diagram of the structure of a graph-based cross-text retrieval system for power safety regulations provided in this application is shown below. Figure 6 As shown in this embodiment, a graph-based cross-text retrieval system for power safety regulations is provided. The system includes:
[0140] The fusion graph construction unit is used to collect power safety regulations documents, preprocess the power safety regulations documents to construct a power safety regulations knowledge dataset, construct an entity relationship graph and an intra-sentence co-occurrence hypergraph related to the proposed questions based on the power safety regulations knowledge dataset, and align and fuse the entity relationship graph and the intra-sentence co-occurrence hypergraph to obtain a fusion graph matrix.
[0141] The evidence subgraph construction unit is connected to the fusion graph construction unit. The evidence subgraph construction unit is used to preset the token budget constraint. Based on the token budget constraint, the information-path collaborative subgraph retrieval algorithm is used to select an evidence subgraph related to the proposed question from the fusion graph matrix.
[0142] The feature vector extraction unit is connected to the evidence subgraph construction unit. The feature vector extraction unit is used to encode the evidence subgraph using a graph neural network and fuse the node features, text information features, topological structure features and type features in the evidence subgraph into a feature vector.
[0143] The answer and reasoning path generation unit is connected to the feature vector extraction unit. The answer and reasoning path generation unit is used to freeze all parameters of the large language model, concatenate the structured soft cue vector and the text information of the evidence subgraph to obtain the input data, and use the large language model after freezing all parameters to process the input data to generate the final answer and the corresponding reasoning path.
[0144] This application provides a cross-text retrieval system for power safety regulations based on graph retrieval. The system extracts and integrates entity relationships and intra-sentence co-occurrence information from documents to form a knowledge graph through a fusion graph construction unit. Then, an evidence subgraph construction unit performs precise retrieval under token budget constraints to select core evidence subgraphs. Next, a feature vector extraction unit uses a graph neural network to encode the multi-dimensional features in the subgraphs into a unified semantic vector. Finally, an answer and reasoning path generation unit uses this vector as a structured prompt to drive a parameter-frozen large language model to generate a text sequence containing the answer and reasoning.
[0145] The system's architecture achieves modular collaboration in data processing, knowledge retrieval, feature fusion, and answer generation. Its advantage lies in the clear, decoupled, and efficient workflow of complex tasks such as knowledge construction, evidence retrieval, and intelligent reasoning through specialized functional unit division. Each unit is tightly integrated, with the output of the previous stage providing precise input for the next, ensuring full automation and high fidelity from unstructured documents to structured knowledge, and finally to accurate reasoned answers. This improves the accuracy of power safety Q&A while also guaranteeing the system's maintainability and scalability.
[0146] Specifically, this invention aligns and merges entity relationship graphs with sentence co-occurrence hypergraphs, performs information-path collaboration subgraph selection on the merged graph, obtains controllable, connected, and complementary evidence subgraphs with a small budget, and then submits them to a large model to generate answers and inference chains to solve multi-hop reasoning problems related to power safety regulations.
[0147] The dataset used in this application is a self-constructed dataset of relevant safety regulations documents issued by the power grid company, containing a total of 1600 samples, divided into training, testing, and validation sets in a 7:2:1 ratio. This invention employs evaluation metrics such as F1 score, ExactMatch (EM), and Path Coverage (PC) to assess the model's performance from multiple perspectives. The specific calculation formulas are as follows:
[0148] ;
[0149] ;
[0150] ;
[0151] in This represents a function for normalizing text. This represents the predicted answer generated by the model for the i-th sample. This represents the gold standard answer corresponding to the i-th sample. This is a comparison function; it returns 1 if x and y are equal, and 0 otherwise. For node coverage, For edge coverage, These are the weight parameters.
[0152] Table 1 shows a performance comparison of different retrieval algorithms.
[0153] Table 1 Performance comparison of different retrieval algorithms (unit: %)
[0154] Model EM F1 PC This invention 65.6 76.2 51.4 PCST 57.8 68.5 35.4 Top-k 59.7 69.4 42.2 PPR 54.9 69.1 34.1
[0155] As shown in Table 1, the experimental results demonstrate that the graph-based cross-text retrieval method for power safety regulations proposed in this invention significantly outperforms baseline methods in all metrics. Regarding the accuracy of answer generation, the EM value of this invention reaches 65.6%, representing improvements of 7.8%, 5.9%, and 10.7% compared to PCST, Top-k, and PPR, respectively; the F1 score reaches 76.2%, improvements of 7.7%, 6.8%, and 7.1%, respectively. This indicates a clear advantage of this invention in generating accurate answers. In terms of path coverage, this invention achieves 51.4%, a significant improvement compared to PCST's 35.4%, Top-k's 42.2%, and PPR's 34.1%, proving that this invention can effectively retrieve evidence subgraphs containing the origin of the answer, providing more sufficient structured evidence support for answer generation.
[0156] The key to the aforementioned performance improvement lies in the proposed dual-layer graph structure and information path collaborative retrieval algorithm. First, by constructing a dual-layer graph structure consisting of an entity relationship graph and an intra-sentence co-occurrence hypergraph, the model can uniformly model power safety regulations knowledge from both entity association and contextual perspectives. This effectively overcomes the limitations of a single retrieval strategy, solves the problem of evidence fragmentation, and lays a solid foundation for constructing a complete reasoning chain. Second, an innovative information-path collaborative subgraph retrieval algorithm is proposed, which simultaneously optimizes semantic relevance and path connectivity during the retrieval process, ensuring that the final selected evidence subgraphs not only have high information density but also good logical coherence. Finally, a graph attention network is used to encode the subgraph structure into soft hints that the large language model can understand. These hints are then concatenated with the textual information of nodes and edges, as well as the question description, and input into the large model. This ensures that while outputting accurate answers, it also reconstructs a clear and traceable reasoning path. In summary, through a series of collaborative technical improvements, this invention significantly enhances the accuracy and interpretability of question answering for complex power safety regulations.
[0157] This invention provides a graph-based cross-text retrieval method for power safety regulations. By constructing a two-layer graph structure integrating an entity relationship graph and an intra-sentence co-occurrence hypergraph, this method effectively captures the semantic relationships across clauses in power safety regulations. It then utilizes an information-path collaborative retrieval algorithm to filter logically coherent evidence subgraphs under a fixed token budget. Finally, it combines graph representation learning to encode the subgraph structure into vector representations for input into a large language model. This method fully exploits the semantic relationships and logical structures between regulation clauses, significantly improving the accuracy and interpretability of multi-hop question answering. This method has broad application prospects in the field of intelligent question answering for power safety regulations, providing power workers with more accurate and traceable safety regulation query services.
Claims
1. A cross-text retrieval method for power safety regulations based on graph retrieval, characterized in that, The reasoning method includes: Collect power safety regulations documents, preprocess the power safety regulations documents to construct a power safety regulations knowledge dataset, construct an entity relationship graph and an intra-sentence co-occurrence hypergraph related to the proposed questions based on the power safety regulations knowledge dataset, and align and fuse the entity relationship graph and the intra-sentence co-occurrence hypergraph to obtain a fused graph matrix; A token budget constraint is preset, and an evidence subgraph related to the proposed question is selected from the fusion graph matrix based on the token budget constraint using an information-path collaborative subgraph retrieval algorithm; The evidence subgraph is encoded using a graph neural network, and the node features, text information features, topological structure features, and type features in the evidence subgraph are fused into a feature vector. The input data is obtained by freezing all parameters of the large language model, concatenating the structured soft cue vector with the text information of the evidence subgraph, and then processing the input data using the large language model with all parameters frozen to generate the final answer and the corresponding reasoning path.
2. The method for cross-text retrieval of power safety regulations based on graph retrieval according to claim 1, characterized in that, The preprocessing of the power safety regulations document to construct a power safety regulations knowledge dataset includes: The power safety regulations document was structured and segmented using regular expressions and PDF text parsing tools to extract the title and corresponding text content of each clause in the document. Based on commonly used punctuation marks, the main text of each clause is segmented into sentences to obtain a set of sentences; The large language model is used to generate corresponding simulated questions, simulated answers, and simulated reasoning chains for each statement in the statement set. The power safety regulations knowledge dataset is constructed using multiple statements, the simulated questions, the simulated answers, and the simulated reasoning chains.
3. The method for cross-text retrieval of power safety regulations based on graph retrieval according to claim 2, characterized in that, The construction of an entity relationship graph and an intra-sentence co-occurrence hypergraph related to the proposed question based on the power safety regulations knowledge dataset includes: An initial set of relation edges is obtained by extracting the relationships between entities in the aforementioned power safety regulations knowledge dataset. The entities related to the proposed problem are filtered through the initial set of relational edges and then expanded in a multi-hop manner to obtain the vertex set and edge set of the entity relation graph. The weighted adjacency matrix of the entity relationship graph is obtained by filtering the vertices in the vertex set based on their relevance scores and path costs.
4. The method for cross-text retrieval of power safety regulations based on graph retrieval according to claim 3, characterized in that, The relevance score of vertices in the vertex set is calculated based on the semantic similarity between the proposed question and the entity, and the path cost is calculated based on the strength of the relationship between the entities.
5. A cross-text retrieval method for power safety regulations based on graph retrieval according to claim 2, characterized in that, The step of constructing an entity relationship graph and an intra-sentence co-occurrence hypergraph related to the proposed problem based on the power safety regulations knowledge dataset, and aligning and fusing the entity relationship graph and the intra-sentence co-occurrence hypergraph to obtain a fused graph matrix, further includes: Each statement in the power safety regulations knowledge dataset is abstracted as a hyperedge, and the hyperedge connects all the entities that appear in the statement. For each statement, a sentence node representing semantics is created. The sentence node is then connected to all entities in the corresponding statement to obtain multiple sentence chains. These multiple sentence chains form a star-shaped connection structure centered on the sentence node. Each sentence chain is assigned a different weight based on the relevance of the statement to the question, and the multiple weights constitute a weighted adjacency matrix of the sentence co-occurrence hypergraph. The weighted adjacency matrix of the entity relationship graph and the weighted adjacency matrix of the intra-sentence co-occurrence hypergraph are linearly fused to obtain the fused graph matrix, which represents the structure of the fused graph.
6. The method for cross-text retrieval of power safety regulations based on graph retrieval according to claim 5, characterized in that, The weights are determined by the positional weight of the statement in the power safety regulations knowledge dataset, the semantic relevance of the statement to the question, and the content relevance of the entity to the question.
7. A cross-text retrieval method for power safety regulations based on graph retrieval according to claim 1, characterized in that, The preset token budget constraint, based on which an information-path collaborative subgraph retrieval algorithm is used to select an evidence subgraph related to the proposed question from the fused graph matrix, including: The cosine similarity between the vector representation of the proposed problem and the vector representations of all nodes and edges in the fusion graph is calculated to obtain the correlation scores of multiple nodes. The k nodes with the highest correlation scores are selected to construct a seed node set. Using each seed node in the seed node set as the root, a bounded breadth-first search with at most L hops is performed in the fusion graph to generate multiple candidate paths; Design a path scoring function, preset the token budget constraint and path scoring threshold, calculate the path scoring function values of multiple candidate paths based on the token budget constraint, and select candidate paths whose path scoring function values are higher than the path scoring threshold for complementary splicing to construct the evidence subgraph.
8. The method for cross-text retrieval of power safety regulations based on graph retrieval according to claim 1, characterized in that, The process of encoding the evidence subgraph using a graph neural network, and fusing the node features, text information features, topological structure features, and type features of the evidence subgraph into a feature vector, includes: The text attributes of each node and edge in the evidence subgraph are converted into initial vector representations using a text encoder; The graph neural network is used to perform message passing and feature aggregation on the evidence subgraph to fuse the node features, the text information features, the topological structure features, and the type features to obtain the feature vector. The feature vector is pooled to generate a graph-level vector representation, which serves as a semantic summary of the evidence subgraph.
9. A cross-text retrieval method for power safety regulations based on graph retrieval according to claim 8, characterized in that, The process involves freezing all parameters of the large language model, concatenating the structured soft cue vector with the text information of the evidence subgraph to obtain input data, and then using the large language model with all parameters frozen to process the input data to generate the final answer and the corresponding reasoning path, including: While keeping all the parameters frozen, a knowledge question-and-answer model for power safety regulations is generated based on Mistral-7B-Instruct. The graph-level vector representation is mapped to the structured soft cue vector, and the structured soft cue vector is concatenated with the text information to obtain the input data; The power safety regulations knowledge question-and-answer model generates a sequence text in an autoregressive manner based on the input data. The sequence text includes the final answer and the corresponding reasoning path.
10. A cross-text retrieval system for power safety regulations based on graph retrieval, characterized in that, The reasoning system applies the reasoning method according to any one of claims 1 to 9, and the reasoning system comprises: A fusion graph construction unit is used to collect the power safety regulations document, preprocess the power safety regulations document to construct the power safety regulations knowledge dataset, construct the entity relationship graph and the intra-sentence co-occurrence hypergraph related to the proposed question based on the power safety regulations knowledge dataset, and align and fuse the entity relationship graph and the intra-sentence co-occurrence hypergraph to obtain the fusion graph matrix. An evidence subgraph construction unit is connected to the fusion graph construction unit. The evidence subgraph construction unit is used to preset the token budget constraint and, based on the token budget constraint, use the information-path collaborative subgraph retrieval algorithm to select an evidence subgraph related to the proposed question from the fusion graph matrix. The feature vector extraction unit is connected to the evidence subgraph construction unit. The feature vector extraction unit is used to encode the evidence subgraph using the graph neural network and fuse the node features, text information features, topological structure features and type features in the evidence subgraph into the feature vector. The answer and reasoning path generation unit is connected to the feature vector extraction unit. The answer and reasoning path generation unit is used to freeze all the parameters of the large language model, concatenate the structured soft hint vector with the text information of the evidence subgraph to obtain the input data, and process the input data using the large language model after freezing all the parameters to generate the final answer and the corresponding reasoning path.