A process-oriented document control flow path retrieval and answer generation method and system
Patent Information
- Application Number
- CN202610741268.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-27
- Publication Date
- 2026-08-18
AI Technical Summary
1. 检索结果虽然局部相关,但无法保证证据之间满足正确的执行顺序;
与传统相似度检索方法相比,本发明在流程型问答中更容易保持步骤顺序和条件分支的一致性;与静态图谱增强方法相比,本发明更贴近流程知识本身的组织方式,能够更自然地表达“过程如何推进”而不仅是“实体之间如何关联”。其核心优势在于:把流程知识用控制流图表示,把检索过程改写为路径探索,再通过多粒度证据空间补足细节,从而在有限上下文预算下输出逻辑更完整、证据更充分的回答。
Smart Images

Figure CN122594430A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the fields of artificial intelligence, natural language processing, knowledge engineering and intelligent question answering, and specifically relates to a method and system for control flow path retrieval and answer generation for process-oriented documents. Background Technology
[0002] Large language models are increasingly used in question answering, decision support, and knowledge services. However, in specialized scenarios, relying solely on the internal knowledge of the model parameters often leads to insufficient factual accuracy and illusion problems. Therefore, retrieval-enhanced generation has become a mainstream approach. Its basic method is to first retrieve relevant text from external knowledge sources and then use the retrieval results as context input to the model to generate answers.
[0003] Current mainstream methods have significant limitations in process-oriented document scenarios. Traditional RAG typically segments the original document into multiple independent text blocks and retrieves data based on the semantic similarity between the query and the text blocks. This approach is suitable for encyclopedic, explanatory, and static factual texts, but it is not ideal for process-oriented documents. This is because the knowledge in process-oriented documents is not organized as independent facts, but rather unfolds as executable processes, emphasizing "what to do first, what to do after meeting certain conditions, and which recovery path to take after failure." If the document is still broken down into unrelated fragments for flattened retrieval, the following problems easily arise: 1. Although the search results are partially relevant, there is no guarantee that the evidence will be executed in the correct order. 2. The conditional branches will be broken down, and the model may piece together a seemingly smooth but logically flawed answer from different branches; 3. When the problem requires reasoning across multiple steps, the model struggles to reconstruct the complete execution chain; 4. When the context budget is limited, the system often wastes a lot of space on weakly related fragments instead of prioritizing the core information of the process that truly determines the answer.
[0004] To address the problem of flat retrieval, some works have attempted to introduce graph structures, such as GraphRAG or other knowledge graph augmentation methods. The advantage of these methods is their ability to explicitly express the relationships between entities and support a certain degree of multi-hop reasoning. However, for process-oriented documents, they still suffer from incomplete matching. The core reason is that entity relationship graphs are better suited for expressing "who is related to whom," while process knowledge emphasizes "how the process proceeds." Simply breaking down the original process into entity, attribute, and relation triples, while yielding a graph structure, may not faithfully preserve the execution logic such as step order, conditional judgments, exception jumps, and backtracking paths.
[0005] Therefore, the core problem to be solved here can be summarized as: how to make the retrieval enhancement generation system organize knowledge not around isolated text blocks or static entity relationships, but around the control structure of the process itself; how to make the system output answers that are both supported by evidence and in line with the logic of the original procedure when answering questions such as "what should be done next", "which branch to take when a certain condition is met" and "how to handle after an anomaly". Summary of the Invention
[0006] To address the problems of existing technologies, this invention provides a method and system for control flow path retrieval and answer generation for process-oriented documents. The core idea of this method is not to simply break down the process document into several independent text blocks, nor to prioritize building a knowledge structure around static entity relationships. Instead, it explicitly represents the execution logic in the process document as a control flow graph, and organizes evidence, performs retrieval, and generates answers around this control flow structure. Overall, the method consists of several parts, including process intermediate representation generation, control flow graph parsing and fusion, multi-granularity evidence space construction, control flow-guided retrieval, and structured evidence generation.
[0007] To achieve the above objectives, the present invention provides the following solution: A method for control flow path retrieval and answer generation for process-oriented documents, the method comprising: Generate an intermediate representation of the process from a collection of process documents; The intermediate representation of the process is parsed into process subgraphs. For multiple process subgraphs obtained from multiple process documents, they are merged according to node semantic similarity and local topological compatibility to form a global control flow graph. Construct a multi-granularity evidence space based on the global control flow graph; Based on a multi-granularity evidence space, retrieval and answer generation are performed.
[0008] Preferably, the method for generating an intermediate representation of the process from a collection of process documents includes: ; in, The parameter is Large language models; This represents the set of model parameters obtained through pre-training or instruction-based fine-tuning. This indicates that a flowchart prompt template will be generated. Process fragments The model input after splicing; This represents the set of control parameters for model inference, including maximum output length, temperature parameter, sampling range, stop sign, format checking rules, and number of retries.
[0009] Preferred methods for constructing multi-granularity evidence spaces based on global control flow graphs include: ; in, Represents the node-level context evidence set. This represents the keyword index set.
[0010] Preferably, the node-level contextual evidence set is represented as follows: ; ; in, Represents a text block semantic vector representation, Represents cosine similarity. Represents a set of text blocks. Represents a node Topology-aware representation. This represents the maximum number of hops in the neighborhood considered. , Represented as in the first Within the jump range, node Predecessor aggregation representation and successor aggregation representation, The basic semantic representation of a node.
[0011] Preferred methods for obtaining the keyword index set include: If the candidate key expression is denoted as Document blocks are denoted as The relevance between key expressions and document blocks is defined as follows: ; in, Indicates candidate keywords The semantic vector representation; Keyword selection uses MMR re-ranking, and its scoring function is: ; Where S represents the set of currently selected keywords, Indicates the similarity between two keywords. This represents the moderating coefficient between correlation and diversity.
[0012] Preferred methods for performing retrieval and generating answers based on multi-granularity evidence spaces include: The lexical relevance and semantic relevance between query and control flow graph nodes are calculated and sorted. The sorting results of the two types of relevance are merged, and several nodes whose scores meet the preset requirements are selected as the starting nodes for subsequent path exploration. Based on the starting node, control flow path exploration is performed; After identifying candidate execution paths, evidence is assembled and answers are generated.
[0013] Preferably, the method of calculating and sorting the lexical relevance and semantic relevance between query and control flow graph nodes, fusing the sorting results of the two types of relevance, and selecting several nodes whose scores meet preset requirements as the starting nodes for subsequent path exploration includes: If the starting node number is set to Then the set of starting nodes is defined as: ; in, Represents a node Compared to query Lexical search ranking position Indicates its semantic search ranking position. This represents the set of nodes in the global control flow graph.
[0014] Preferably, the method for exploring control flow paths based on the starting node includes: If the partial path at step t is denoted as The current node is The set of candidate successor nodes is denoted as The next hop decision is then expressed as: ; Based on the next-hop decision representation, the resulting set of execution paths is represented as follows: ; in, Indicates the first Candidate execution paths, This indicates the final number of candidate execution paths. Indicates the number of starting nodes.
[0015] Preferably, the methods for evidence assembly and answer generation after identifying candidate execution paths include: If path The contextual evidence of all nodes together constitutes the structural evidence of the path, then: ; Structured search results are defined as: ; At the same time, supplementary auxiliary evidence related to the query is obtained from the fine-grained semantic index, which is written in the following form: ; in, Indicates a query The supplementary evidence set retrieved from the fine-grained keyword index; Indicates from the query A set of keywords or key expressions extracted from the text; Represents a set of keywords Any keyword or key expression in it; Indicated by keywords As the entry point for retrieval, in the keyword index A retrieval function to recall relevant document blocks or evidence fragments; The final answer is generated by inputting structured path evidence, supplementary fine-grained evidence, and user questions into a large language model. ; And satisfy the context budget constraint: ; in, This represents the structured serialization result of the path and its evidence. This indicates the result of piecing together supplementary evidence at a finer granular level. This indicates the maximum context budget allowed by the system.
[0016] This invention also provides a control flow path retrieval and answer generation system for process-oriented documents. The system is used to implement the aforementioned method and includes: a syntax-constrained intermediate representation generation module, a control flow graph parsing module, a multi-granularity evidence space construction module, and a graph retrieval and answer generation module. The syntax-constrained intermediate representation generation module is used to generate an intermediate representation of the process from a collection of process documents; The control flow graph parsing module is used to parse the intermediate representation of the process into process subgraphs. For multiple process subgraphs obtained from multiple process documents, the module merges them according to the semantic similarity of nodes and local topological compatibility to form a global control flow graph. The multi-granularity evidence space construction module is used to construct a multi-granularity evidence space based on the global control flow graph; The graph retrieval and answer generation module is used to perform retrieval and generate answers based on a multi-granularity evidence space.
[0017] Compared with the prior art, the beneficial effects of the present invention are as follows: Compared to traditional similarity retrieval methods, this invention more easily maintains consistency in step order and conditional branches in process-oriented question answering. Compared to static graph enhancement methods, this invention is closer to the organization of process knowledge itself, and can more naturally express "how the process progresses" rather than just "how entities are related." Its core advantages lie in: representing process knowledge with a control flow graph, rewriting the retrieval process as path exploration, and supplementing details with a multi-granularity evidence space, thereby outputting more logically complete and more evidence-rich answers within a limited context budget. Attached Figure Description
[0018] To more clearly illustrate the technical solution of the present invention, the drawings used in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 This is a schematic diagram of a control flow path retrieval and answer generation method for process-oriented documents according to an embodiment of the present invention; Figure 2 This is a schematic diagram showing the context budget λ increased from 3000 to 9000 in an embodiment of the present invention, compared with the baseline method. Detailed Implementation
[0020] The technical solutions of the embodiments of the present invention 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. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0021] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0022] Example 1 The goal of this invention is not simply to improve text relevance in general question-and-answer scenarios, but rather to establish a technical solution more suitable for the expression, retrieval, and generation of process knowledge for process-oriented questions. Specifically, in the offline construction phase, the aim is to preserve as much of the sequential structure, conditional structure, and exception handling structure as possible in the process document, so that the execution logic in the original procedure can be represented more completely; in the online retrieval phase, the system can explore paths along the process structure to identify execution paths consistent with the query conditions; in the evidence organization phase, the aim is to retain both the main process information and fine-grained supplementary information outside the structural paths, so that the answer not only conforms to the process logic but also has the necessary detailed support; in the answer generation phase, the aim is to guide the model to prioritize answers based on evidence with consistent structure and higher information density; and in terms of overall effect, the aim is to further improve the correctness of answers, logical consistency, and context utilization efficiency in process question-and-answer tasks.
[0023] To achieve the aforementioned objectives, this invention provides a control flow path retrieval and answer generation method for process-oriented documents, specifically a retrieval enhancement generation method designed for process-oriented documents. This method is applicable to document scenarios with clear step sequences, conditional branches, and state transitions, such as industrial operation and maintenance procedures, equipment maintenance manuals, service operation specifications, fault handling plans, and emergency response procedures. The core idea of this method is not to simply break down the process document into several independent text blocks, nor to prioritize building a knowledge structure around static entity relationships. Instead, it explicitly represents the execution logic in the process document as a control flow graph, and organizes evidence, performs retrieval, and generates answers around this control flow structure. Overall, this method consists of several parts, including process intermediate representation generation, control flow graph parsing and fusion, multi-granularity evidence space construction, control flow-guided retrieval, and structured evidence generation.
[0024] Formal definition To more clearly describe the input, knowledge space, and output target of this method, we can first provide a set of formal definitions. Let the original set of process documents be denoted as: Each document Describe one or more executable procedures. The knowledge space built around this type of document can be represented as: in, Indicates the process execution topology. This represents the evidence space constructed around the process topology. The control flow graph is further represented as: in, A set of logical execution units. Let be a set of directed edges. This is a collection of edge types. (Based on user queries) The system aims to retrieve a set of execution paths related to the problem: Each path All are sequences of nodes that satisfy control flow consistency. The system ultimately outputs answer 'a', and its generation objective can be written as: in, Indicates the context of the query The organization obtains a structured context. To ensure practical usability, this context also satisfies budget constraints: This means that the approach does not simply pursue "retrieving more", but rather constructs a context that is both supported by evidence and consistent with the process within a limited budget.
[0025] Specific examples Figure 1 As shown, the method includes: Generate an intermediate representation of the process from a collection of process documents; The intermediate representation of the process is parsed into process subgraphs. For multiple process subgraphs obtained from multiple process documents, they are merged according to node semantic similarity and local topological compatibility to form a global control flow graph. Construct a multi-granularity evidence space based on the global control flow graph; Based on a multi-granularity evidence space, retrieval and answer generation are performed.
[0026] Process knowledge construction 1. Generation of intermediate representations in a syntax-constrained process Upon receiving a process segment, the system does not directly generate a graph structure from natural language in one step. Instead, it first generates a grammatically constrained intermediate representation of the process. Mermaid flowchart syntax can be used as a carrier here. The reason for introducing an intermediate representation is that direct graph construction can easily lead to structural illusions, missing nodes, or non-closed branches. By generating a constrained intermediate representation first, and then parsing it into a graph structure according to rules, "semantic understanding" and "graph structure instantiation" can be separated, thereby improving the stability and consistency of the structure construction. If a single process segment is denoted as... Then its corresponding intermediate representation can be written as: in, This is a prompt template for flowchart output design. It explicitly constrains node types, edge types, and output format, thus avoiding the generation of free text with a messy structure in the model. This represents the inference function for the large language model generated during the intermediate representation process. This function can be further represented as: in The parameter is Large language models; This represents the set of model parameters obtained through pre-training or instruction-based fine-tuning. This indicates that a flowchart prompt template will be generated. Process fragments The model input after splicing; This represents the set of control parameters for model inference, including maximum output length, temperature parameters, sampling range, stop symbols, format checking rules, and number of retries.
[0027] 2. Mermaid Flowchart Analysis The system parses the intermediate representation into a flowchart. Specifically, the system first performs a syntax check on the Mermaid intermediate representation, identifying node declarations, connections, branch labels, and back jumps, and then converts it into a flowchart. in Indicates the first The set of nodes corresponding to each process segment. This represents the set of directed edges between nodes. This represents a set of edge types. During parsing, rectangular nodes in Mermaid are mapped to operation nodes, diamond nodes to decision nodes, nodes representing device status, process status, or intermediate status are mapped to status nodes, and nodes representing completion, failure, termination, or output results are mapped to result nodes. Connections in Mermaid are parsed as control flow edges: ordinary connections represent sequential execution relationships, connections with labels such as "yes / no," "satisfied / unsatisfied," and "normal / abnormal" represent conditional branching relationships, connections with semantics such as "fault," "alarm," "overlimit," and "abnormal handling" represent abnormal transfer relationships, and connections pointing to preceding nodes represent loop return relationships. In other words, the system does not simply extract "entity-relationship-entity" triples, but rather converts the operations, decisions, state changes, and result outputs in the original document into an executable control flow structure according to flowchart syntax. This preserves the execution logic in the process document, such as "what to execute first, which branch to enter after the condition is met, how to jump after an exception, and whether to return to the preceding step."
[0028] For multiple process subgraphs obtained from multiple process documents, the system further merges them according to node semantic similarity and local topological compatibility to form a global control flow graph.
[0029] This diagram is not a static entity-relationship diagram, but rather an execution structure diagram that directly expresses the logic of process progression. Let the multiple process sub-diagrams be: The system fusion yields a global control flow graph: During merging, semantic similarity and local topological compatibility need to be considered. Node semantic similarity is used to determine whether two nodes express similar operations, judgments, or state meanings; local topological compatibility is used to determine whether the predecessor nodes, successor nodes, branch positions, and execution stages of two nodes are consistent in their respective processes. Only when two nodes are semantically similar and their upstream and downstream positions in the process structure are also compatible will the system merge them into the same global node. Specifically, for two candidate nodes... and The system calculates the combined score of the two: in, Indicates candidate nodes and The overall score; Indicates the semantic similarity between two nodes; This indicates the local topology compatibility between two nodes; and This represents the weighting parameter, used to adjust the influence of semantic similarity and topological compatibility in node fusion.
[0030] 3. Multi-granularity evidence mounting While control flow graphs effectively represent the execution topology of a process, they cannot fully encompass the semantic details of the original document. Therefore, the system further constructs a multi-granularity evidence space on top of the control flow graph, associating the structured process representation with the original textual evidence. This evidence space comprises two parts: node-level contextual evidence and fine-grained keyword indexes. The former supports the semantic interpretation of process nodes, while the latter supplements detailed information beyond the structural representation. Thus, the system can simultaneously ensure process consistency and semantic integrity.
[0031] Knowledge Retrieval 1. Starting node positioning After query comprehension is complete, the system calculates the lexical and semantic relevance between the query and control flow graph nodes. Specifically, let the global control flow graph be: in, This represents the global control flow graph obtained after fusion; It represents a set of nodes in the global control flow graph. Each node corresponds to a logical execution unit in the process document, such as an operation node, decision node, status node, or result node. It represents the set of directed edges between nodes, used to express execution dependencies such as sequential execution, conditional branching, exception transfer, and loop return in the process; This represents the set of edge types. For any node... The system concatenates the node text, node type, condition tags, and relevant context descriptions into the node retrieval text: in, Represents a node The corresponding search text; Represents a node The text description; Indicates the node type; Represents nodes Related conditional labels, such as "condition met", "condition not met", "alarm", "abnormal", "exceeding limits", etc.; This indicates a text concatenation operation. First, the system uses... Calculate query With nodes Lexical relevance between them: in, Indicates query With nodes The word relevance score between them; Indicates query Terms in; Indicates terms Retrieve text from nodes Frequency of occurrence in; Indicates the node retrieves text. Length; This represents the average length of the retrieved text across all nodes; This represents the word frequency saturation adjustment parameter, used to control the impact of word frequency growth on relevance scores; This represents the text length normalization parameter, used to adjust the impact of differences in node text length on relevance calculation; IDF Indicates terms The inverse document frequency. Among them, IDF... It can be defined as: in, This represents the total number of nodes in the global control flow graph; Indicates included terms The number of nodes. If a term appears in fewer nodes, then its... A higher number indicates that the term has stronger discriminative power; if a term appears in a large number of nodes, then its... The low similarity indicates that the term has a weak effect on node differentiation. Secondly, the system uses semantic vector similarity to calculate the query. With nodes Semantic relevance between them: in Indicates query With nodes Semantic relevance score between them; Indicates query The semantic vector representation; Represents a node The semantic vector representation; This represents the cosine similarity calculation function. Node vectors. Can be derived from node text The encoded data can also be represented by a topology-aware node that integrates predecessor nodes, successor nodes, and local topological context, so that semantic matching considers not only the node's own text, but also the upstream and downstream semantics of the node in the process structure.
[0032] The system sorts all nodes v∈V based on both lexical relevance scores and semantic relevance scores. The sorting position based on the BM25 score is denoted as... , Represents a node Compared to query The ranking position in the lexical retrieval algorithm. A higher ranking position indicates a stronger lexical match between the node and the query. The ranking position obtained based on the semantic vector similarity score is denoted as... , This indicates the semantic search ranking position. The higher the ranking position, the stronger the semantic relevance between the node and the query.
[0033] To leverage the advantages of both lexical and semantic matching, the system employs an RRF ranking fusion method to combine the two ranking results and selects several nodes with the highest scores as starting nodes for subsequent path exploration. If the number of starting nodes is set to... Then the set of starting nodes can be defined as: 2. Control Flow Path Exploration Unlike traditional RAG methods that retrieve multiple text blocks at once, this method redefines the retrieval process as a path exploration process on a control flow graph. Starting from the initial node, the system combines the user's question, the currently explored path, the evidence at the current node, and candidate successor nodes to progressively determine the next step. When encountering a decision node, the system prioritizes the branch that matches the user's question conditions. Thus, the retrieval process is no longer simply "finding the most similar text," but rather "finding the most reasonable execution path."
[0034] If the partial path at step t is denoted as The current node is The set of candidate successor nodes is denoted as Then the next hop decision can be expressed as: The agent's output can be either a successor node or a stop to exploration. The resulting set of execution paths can be represented as: in Indicates the first Candidate execution paths, This indicates the final number of candidate execution paths. Indicates the number of starting nodes.
[0035] 3. Evidence Assembly and Answer Generation After identifying candidate execution paths, the system first organizes the contextual evidence bound to each node according to the execution order of the path, and then retrieves supplementary evidence related to the query from a fine-grained index to enhance the coverage of detailed information beyond the main path. Under context budget constraints, the system prioritizes retaining path evidence that can support the main logical framework of the answer, and then supplements it with fine-grained auxiliary evidence directly related to the query, thus forming an input context that combines structural consistency and semantic integrity. If the path... The contextual evidence of all nodes together constitutes the structural evidence of the path, then: Furthermore, structured search results can be defined as: At the same time, the system also supplements the query with auxiliary evidence from the fine-grained semantic index, which can be written in the following form: in, Indicates a query The supplementary evidence set retrieved from the fine-grained keyword index; Indicates from the query The extracted keywords or key expressions can include equipment name, component name, fault phenomenon, status description, operation action, parameter name, threshold condition and anomaly type, etc. Represents a set of keywords Any keyword or key expression in it; This represents a fine-grained keyword index, which is used to establish a mapping relationship between keywords or key expressions and original document blocks; Indicated by keywords As the entry point for retrieval, in the keyword index A retrieval function that recalls relevant document blocks or evidence fragments.
[0036] Based on this, the system inputs structured path evidence, supplementary fine-grained evidence, and user questions into a large language model to generate the final answer, namely: And satisfy the context budget constraint: in, This represents the structured serialization result of the path and its evidence. This indicates the result of piecing together supplementary evidence at a finer granular level. This indicates the maximum context budget allowed by the system.
[0037] By using the above methods, the final result can not only answer the question by following the execution path consistent with the question, but also be linked back to the specific path source and key evidence, thereby improving the interpretability and traceability of the answer.
[0038] Example 2 This invention also provides a control flow path retrieval and answer generation system for process-oriented documents. The system is used to implement the method described in Embodiment 1. The system includes: a syntax-constrained intermediate representation generation module, a control flow graph parsing module, a multi-granularity evidence space construction module, and a graph retrieval and answer generation module. The syntax-constrained intermediate representation generation module is used to generate intermediate representations of the process from a collection of process documents; The control flow graph parsing module is used to parse the intermediate representation of the process into process subgraphs. For multiple process subgraphs obtained from multiple process documents, the module merges them according to the semantic similarity of nodes and local topological compatibility to form a global control flow graph. A multi-granularity evidence space construction module is used to construct a multi-granularity evidence space based on a global control flow graph; The graph retrieval and answer generation module is used to perform retrieval and generate answers based on a multi-granularity evidence space.
[0039] Process knowledge construction The entire solution begins by establishing a computable knowledge space around the process documents. Unlike typical document indexes, this solution does not construct a simple vector library or a static entity relationship graph, but rather a control flow knowledge space centered on the process execution structure.
[0040] 1. Syntax-constrained intermediate representation generation module After obtaining the process fragment, the system calls a large language model to generate a grammatically constrained intermediate representation of the process. This paper adopts the Mermaid flowchart syntax as the intermediate representation form, mainly because this syntax can well characterize common process structures such as sequential execution, conditional branching, and loop iteration, while also possessing strong standardization, facilitating subsequent syntax validation, rule parsing, and structured processing. Compared to the free description in natural language, Mermaid is closer to a machine-processable semi-structured expression, thus making it more suitable as a transitional representation connecting the original text and the control flow graph. To ensure stable structural consistency in the generated results, the output range of the model needs to be explicitly limited in the design of the prompt words, including the allowed node types, edge types, branch representation methods, loop representation methods, and overall output format. After generation, the system also needs to perform a syntax check on the intermediate representation; when problems such as unclosed nodes, illegal edge connections, or incomplete structures occur, an automatic correction or regeneration mechanism is triggered. If a single process fragment is denoted as... Then its corresponding intermediate representation can be written as: Here These are not ordinary question-and-answer prompts, but rather flow prompt templates with explicit constraints on the output structure. Their purpose is to transcribe the execution logic in natural language into a unified, semi-structured flow representation.
[0041] 2. Control Flow Graph Parsing Module During the control flow graph parsing phase, the system first parses the intermediate representation that passes the syntax check and converts it into the corresponding flow subgraph. In this process, operational statements in the text are mapped to operation nodes, conditional statements are mapped to decision nodes, state descriptions are mapped to state nodes, and content representing semantics such as termination, completion, or failure is assigned to result nodes. At the same time, the sequential progression relationships, conditional branch relationships, exception transfer relationships, and repeated execution relationships in the original flow are parsed into different types of directed edges, thus forming a local control flow structure that reflects the execution logic.
[0042] Since corpora typically consist of multiple process documents, the final knowledge space constructed by the system cannot remain within a single document but needs to be further integrated into a unified global control flow graph. To improve the quality of integration, the system considers both semantic similarity and local topological consistency when aligning nodes. This means not only determining whether two nodes express similar process meanings at the semantic level but also examining whether they possess reasonable compatibility relationships in terms of predecessors, successors, and adjacency structures. Through this integration mechanism, a global process knowledge space can ultimately be formed that covers multiple process documents while maintaining structural accuracy and execution consistency as much as possible.
[0043] 3. Multi-granularity evidence space construction module Control flow graphs are responsible for representing the process structure, but the graph nodes themselves are usually quite short and cannot fully convey the explanatory information in the original text. Therefore, the system needs to further construct an evidence space around the control flow graph. Formally, the evidence space can be represented as: in, Represents the node-level context evidence set. This represents the keyword index set.
[0044] Node-level contextual evidence construction module: The role of node-level contextual evidence is to supplement the semantic background of each node in the control flow graph with its original document, so that the node not only represents a local flow action, but can also be associated with a more complete contextual description. For any node... If its text description is denoted as The semantic encoder is denoted as Then, the basic semantic representation of the node can be obtained first: This representation reflects the local semantics of the node itself, but since many nodes in the flowchart can only be accurately understood in conjunction with their upstream and downstream execution relationships, it is necessary to further introduce the topological context surrounding the node. Let... and Representing nodes respectively In distance The system aggregates the neighborhood information of a given location by considering its predecessor and successor neighbor sets, and then performs attenuation aggregation on this neighborhood information, where the attenuation coefficient is denoted as . Therefore, in the first Within the jump range, node The predecessor aggregation representation and the successor aggregation representation can be written as follows: in, Represents neighboring nodes.
[0045] After integrating the semantics of the node itself and the semantic information of its predecessors and successors within a multi-hop range, the node can be obtained. Topology-aware representation: in, This represents the maximum number of hops in the neighborhood that is considered.
[0046] Based on this topology-aware representation, the system further segments the original document into a set of text blocks. Perform similarity retrieval in the middle and compare it with the nodes. The most relevant text fragments serve as contextual evidence, therefore the node The corresponding set of contextual evidence can be defined as: in, Represents a text block semantic vector representation, The cosine similarity is used. Therefore, the construction of node-level contextual evidence does not simply rely on literal matching of the node text itself, but rather utilizes topologically aware representations that incorporate local process structure information to align nodes with the original document evidence, thereby improving the accuracy of node semantic interpretation and evidence binding.
[0047] Fine-grained keyword indexing module: Node-level evidence alone is insufficient to cover all the information needed for an answer, because the original document contains fine-grained semantic information that is not directly attached to individual process nodes but plays a crucial supporting role in the question-and-answer result. Therefore, the system further constructs a fine-grained semantic index on the original text blocks, extracting representative key expressions and retaining high-value items through a joint screening mechanism of relevance and diversity. Simultaneously, it establishes a mapping relationship between these key expressions and the source text blocks. This index is not used to replace the control flow graph, but rather as a supplementary evidence channel running parallel to the main process: the control flow path is used to determine the execution process corresponding to the question, while the fine-grained semantic index is used to supplement local explanatory information outside the structural path, thereby improving the completeness and accuracy of the final answer. The relevance between keywords and document blocks can be defined as: in, Indicates from document block The first one drawn One candidate keyword. This represents the original document block to be indexed. This represents a semantic encoding function used to map keywords, key expressions, or document blocks to the same vector space. Indicates candidate keywords semantic vector representation, Represents a document block The semantic vector representation of .
[0048] To balance relevance and diversity, keyword selection employs MMR re-ranking, with the following scoring function: Where S represents the set of currently selected keywords, Indicates the similarity between two keywords. This represents the moderating coefficient between correlation and diversity.
[0049] Map retrieval and answer generation module After query comprehension is complete, the system calculates the lexical and semantic relevance between the query and control flow graph nodes. The lexical channel is better suited for capturing explicit term matching relationships in the query, while the semantic channel is better suited for handling synonyms, descriptive conditions, and semantic-level approximate matches. The system merges the two ranking results and selects several nodes with the highest scores as starting nodes for subsequent path exploration. If the number of starting nodes is set to... Then the set of starting nodes can be defined as in, Represents a node Compared to query Lexical search ranking position This indicates its semantic search ranking position.
[0050] During the exploration process, the system comprehensively utilizes the user's question, the currently formed partial paths, the candidate successor nodes of the current node, and the contextual evidence bound to that node, combined with preset stopping conditions and the maximum exploration depth, to make the next hop decision. Especially when the current node is a decision node, the system needs to select a more reasonable successor branch based on the constraints given in the query. Therefore, the entire retrieval process is essentially a path selection process oriented towards consistent execution logic, rather than simply a static matching based on text similarity. Let the partial path at step t be denoted as... The current node is The set of candidate successor nodes is denoted as Then the next hop decision can be expressed as: in, Indicates the current node The set of candidate successor nodes, This represents the contextual evidence bound to the current node. When When a stop signal is output, path exploration terminates; otherwise, the selected successor node is appended to the current path, and the path continues to expand. The final set of execution paths can be represented as follows: After obtaining candidate paths, the system further assembles evidence and generates answers. Specifically, the system first organizes the node-level contextual evidence along the path according to the execution order, forming structured evidence that reflects the main flow; then, it supplements the evidence with auxiliary evidence related to the question from a fine-grained semantic index. The final context input to the large language model possesses both structural consistency and the ability to retain necessary details. If the path... The contextual evidence of all nodes together constitutes the structural evidence of the path, then we have Furthermore, structured search results can be defined as... At the same time, the system also supplements the query with auxiliary evidence from the fine-grained semantic index, which can be written in the form of: Based on this, the system inputs structured path evidence, supplementary fine-grained evidence, and user questions into a large language model to generate the final answer, i.e. And satisfy the context budget constraint in, This represents the structured serialization result of the path and its evidence. This indicates the result of piecing together supplementary evidence at a finer granular level. This indicates the maximum context budget allowed by the system.
[0051] Example 3 Table 1 Overall Performance Comparison Results To verify the effectiveness of this method in process-oriented question-answering scenarios, a dedicated experimental dataset was constructed based on real service operation procedures, and overall performance comparison experiments were conducted on this dataset. The experimental data includes 732 process documents and 1957 question-answer samples, which can well cover common scenarios in process-oriented knowledge such as sequential execution, conditional branching, exception handling, and multi-step linkage. Unlike general factual question-answering, this type of task not only requires the system to retrieve relevant text, but also requires it to identify the process stage, judgment conditions, and subsequent action sequence corresponding to the question. Therefore, it is more suitable for testing the retrieval system's ability to model execution logic.
[0052] In the experimental setup, this method was compared with the `NativeRAG`, `GraphRAG`, and `LightRAG` series methods, and evaluated under multiple generative model conditions of different scales to examine the stability and generality of the method. Evaluation metrics covered three aspects: retrieval quality, generation quality, and construction cost, with a focus on metrics such as evidence coverage completeness, answer relevance, answer correctness, consistency of process logic, and indexing overhead.
[0053] The experimental results are shown in Table 1. Our proposed method demonstrates strong stability across multiple generative model settings. It outperforms other methods in terms of evidence coverage completeness and answer correctness, particularly in terms of consistency of process logic. This indicates that our method not only retrieves more supporting information related to the question but also organizes evidence along an execution path consistent with the query conditions, thus generating answers that better conform to the original procedural structure. In contrast, while similarity retrieval methods can return several semantically relevant fragments, they struggle to recover the sequential relationships and conditional dependencies in multi-step processes. Graph augmentation methods, although introducing structural information, typically still focus on entity associations, making it difficult to fully express the execution topology in process knowledge. Therefore, they still have limitations in complex process question answering.
[0054] Further analysis reveals that the advantage of this method does not simply rely on a larger context window or more candidate texts, but rather stems from the joint optimization of the process structure and evidence organization. On one hand, through constrained intermediate process representation and control flow graph modeling, the system can explicitly preserve the step sequence, branching relationships, and state transitions in the original procedure. On the other hand, through the collaborative organization of node-level contextual evidence and fine-grained auxiliary evidence, the system retains both the main process and supplements the detailed information required for the response. Therefore, this method demonstrates stronger comprehensive capabilities in terms of overall response quality, structural consistency, and result interpretability.
[0055] Furthermore, from a cost perspective, this method achieves good experimental results without introducing an excessive burden of offline indexing. Compared to graph augmentation methods that rely on large-scale entity extraction and relation induction, this method has a more direct knowledge construction process, enabling the formation of a structured knowledge space oriented towards process-based question answering at a relatively low cost. This demonstrates that the method is not only effective experimentally but also possesses good potential for engineering implementation, making it suitable for practical applications with high requirements for process consistency, traceability, and response quality.
[0056] Example 4 Table 2 Comparison results of different modules To analyze the contribution of each core module to system performance, a uniform ablation experiment was conducted on the complete method under the default Qwen3-14B settings. The Coverage, Correctness, Relevancy, and Logic scores of the complete FlowRAG were 89.81, 84.02, 85.87, and 67.34, respectively. After removing the syntactically constrained intermediate representations, the above four metrics became 76.93, 75.30, 84.65, and 57.26, respectively; after removing control flow path exploration, they became 89.26, 78.39, 63.95, and 60.42, respectively; after removing fine-grained keyword indexing, they became 84.15, 83.82, 82.98, and 66.05, respectively; and after removing topology-aware representations, they became 87.89, 83.21, 85.04, and 63.25, respectively.
[0057] These results show that the intermediate representation, constrained by syntax, has the greatest impact on overall performance. Removing this module reduced Coverage, Correctness, and Logic by 12.88, 8.72, and 10.08 percentage points, respectively, indicating that without first converting the natural language flow into a standardized, parsable intermediate representation, subsequent graph construction cannot stably preserve the execution structure of the original flow. Removing control flow path exploration only slightly reduced Coverage by 0.55 percentage points, but Relevancy, Correctness, and Logic decreased by 21.92, 5.63, and 6.92 percentage points, respectively. This suggests that merely retrieving locally relevant evidence is insufficient; the system also needs to organize the evidence along a reasonable execution path to form a logical answer consistent with the question.
[0058] Furthermore, after removing the fine-grained keyword index, Coverage decreased from 89.81 to 84.15, while Relevancy, Correctness, and Logic also decreased by 2.89, 0.20, and 1.29 percentage points, respectively. This indicates that relying solely on process node-level evidence is insufficient to cover all the detailed information required for the answer, and fine-grained indexing has practical value in supplementing auxiliary evidence beyond the structural path. After removing the topology-aware representation, Coverage, Correctness, and Logic decreased by 1.92, 0.81, and 4.09 percentage points, respectively, demonstrating that introducing local topological context during node-level evidence binding helps improve the alignment quality between nodes and original text blocks, thereby enhancing the accuracy of the answer and the consistency of the process. Overall, the four core modules respectively play the roles of structural expression, path organization, detail supplementation, and structural alignment, collectively constituting the key technical foundation of this method.
[0059] Example 5 To analyze the method's performance under a finite context budget, the context budget λ was increased from 3000 to 9000, and compared with the baseline method. Figure 2 The results show that the baseline methods are significantly dependent on larger context budgets. For example, the coverage of NativeRAG increased from 63.60 to 88.23, GraphRAG from 50.11 to 75.88, and LightRAG-H from 58.86 to 82.99; the correctness of NativeRAG increased from 43.09 to 71.18, GraphRAG from 57.02 to 73.86, and LightRAG-H from 68.17 to 80.08.
[0060] In contrast, this method already outperformed all baselines at λ=3000, and the performance improvement became more gradual as the budget continued to increase. This indicates that its advantage mainly comes from the selection and organization of structured evidence, rather than simply relying on a larger context window.
[0061] Example 6 Select a typical problem as a case study: "What should the operator do next if an A12 alarm occurs after the equipment is started and the coolant level is below the safety threshold?" The difficulty of this problem lies not in identifying individual keywords, but in simultaneously satisfying the following requirements: 1. Identify the current alarm event as A12; 2. The identification condition constraint is that the coolant level is below the safety threshold; 3. The question asks for "next steps," not a generalized fault analysis; 4. Answers must adhere to the conditional branches and step sequence in the original procedure.
[0062] In this case, NativeRAG can retrieve some relevant fault handling snippets, but cannot clearly indicate the next specific action; GraphRAG can link A12 with cooling system and pump checks, but because it does not retain the process branch logic, it is prone to mistakenly prioritizing pump checks; LightRAG can capture cooling system-related content, but it is still not clear enough. In contrast, this method explores the path along the "liquid level below threshold" branch, first locating "replenish coolant," and then further organizing subsequent steps such as "start the circulation pump" and "alarm reset," thus outputting an action sequence that more closely conforms to the original procedure.
[0063] This case illustrates that the real problem this method solves is not "whether or not relevant text can be found," but rather "whether or not a chain of evidence that conforms to the process logic can be found."
[0064] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Various modifications and improvements made to the technical solutions of the present invention by those skilled in the art without departing from the spirit of the present invention should fall within the protection scope defined by the claims of the present invention.
Claims
1. A method for control flow path retrieval and answer generation for process-oriented documents, characterized in that, The method includes: Generate an intermediate representation of the process from a collection of process documents; The intermediate representation of the process is parsed into process subgraphs. For multiple process subgraphs obtained from multiple process documents, they are merged according to node semantic similarity and local topological compatibility to form a global control flow graph. Construct a multi-granularity evidence space based on the global control flow graph; Based on a multi-granularity evidence space, retrieval and answer generation are performed.
2. The method according to claim 1, characterized in that, Methods for generating intermediate process representations from a collection of process documents include: ; in, The parameter is Large language models; This represents the set of model parameters obtained through pre-training or instruction-based fine-tuning. This indicates that a flowchart prompt template will be generated. Process fragments The model input after splicing; This represents the set of control parameters for model inference, including maximum output length, temperature parameter, sampling range, stop sign, format checking rules, and number of retries.
3. The method according to claim 1, characterized in that, Methods for constructing multi-granularity evidence spaces based on global control flow graphs include: ; in, Represents the node-level context evidence set. This represents the keyword index set.
4. The method according to claim 3, characterized in that, The node-level context evidence set is represented as: ; ; in, Represents a text block semantic vector representation, Represents cosine similarity. Represents a collection of text blocks. Represents a node Topology-aware representation. This represents the maximum number of hops in the neighborhood considered. , Represented as in the first Within the jump range, node Predecessor aggregation representation and successor aggregation representation, The basic semantic representation of a node.
5. The method according to claim 4, characterized in that, Methods for obtaining a keyword index set include: If the candidate key expression is denoted as Document blocks are denoted as The relevance between key expressions and document blocks is defined as follows: ; in, Indicates candidate keywords The semantic vector representation; Keyword selection uses MMR re-ranking, and its scoring function is: ; Where S represents the set of currently selected keywords, Indicates the similarity between two keywords. This represents the moderating coefficient between correlation and diversity.
6. The method according to claim 5, characterized in that, Methods for retrieval and answer generation based on multi-granularity evidence spaces include: The lexical relevance and semantic relevance between query and control flow graph nodes are calculated and sorted. The sorting results of the two types of relevance are merged, and several nodes whose scores meet the preset requirements are selected as the starting nodes for subsequent path exploration. Based on the starting node, control flow path exploration is performed; After identifying candidate execution paths, evidence is assembled and answers are generated.
7. The method according to claim 6, characterized in that, The method of calculating and ranking the lexical and semantic relevance between query and control flow graph nodes, fusing the ranking results of the two types of relevance, and selecting several nodes whose scores meet preset requirements as the starting nodes for subsequent path exploration includes: If the starting node number is set to Then the set of starting nodes is defined as: ; in, Represents a node Compared to query Lexical search ranking position Indicates its semantic search ranking position. This represents the set of nodes in the global control flow graph.
8. The method according to claim 7, characterized in that, The methods for exploring control flow paths based on the starting node include: If the partial path at step t is denoted as The current node is The set of candidate successor nodes is denoted as The next hop decision is then expressed as: ; Based on the next-hop decision representation, the resulting set of execution paths is represented as follows: ; in, Indicates the first Candidate execution paths, This indicates the final number of candidate execution paths. Indicates the number of starting nodes.
9. The method according to claim 8, characterized in that, After identifying candidate execution paths, methods for evidence assembly and answer generation include: If path The contextual evidence of all nodes together constitutes the structural evidence of the path, then: ; Structured search results are defined as: ; At the same time, supplementary auxiliary evidence related to the query is obtained from the fine-grained semantic index, which is written in the following form: ; in, Indicates a query The supplementary evidence set retrieved from the fine-grained keyword index; Indicates from the query A set of keywords or key expressions extracted from the text; Represents a set of keywords Any keyword or key expression in it; Indicated by keywords As the entry point for retrieval, in the keyword index A retrieval function to recall relevant document blocks or evidence fragments; The final answer is generated by inputting structured path evidence, supplementary fine-grained evidence, and user questions into a large language model. ; And satisfy the context budget constraint: ; in, This represents the structured serialization result of the path and its evidence. This indicates the result of piecing together supplementary evidence at a finer granular level. This indicates the maximum context budget allowed by the system.
10. A control flow path retrieval and answer generation system for process-oriented documents, the system being used to implement the method described in any one of claims 1-9, characterized in that, The system includes: a syntax-constrained intermediate representation generation module, a control flow graph parsing module, a multi-granularity evidence space construction module, and a graph retrieval and answer generation module; The syntax-constrained intermediate representation generation module is used to generate an intermediate representation of the process from a collection of process documents; The control flow graph parsing module is used to parse the intermediate representation of the process into process subgraphs. For multiple process subgraphs obtained from multiple process documents, the module merges them according to the semantic similarity of nodes and local topological compatibility to form a global control flow graph. The multi-granularity evidence space construction module is used to construct a multi-granularity evidence space based on the global control flow graph; The graph retrieval and answer generation module is used to perform retrieval and generate answers based on a multi-granularity evidence space.