A knowledge question and answer method and system based on hybrid retrieval enhancement
Patent Information
- Application Number
- CN202611445929.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-17
- Publication Date
- 2026-10-20
AI Technical Summary
[0006]现有方案中,单纯依赖关键词或文本匹配方式难以兼顾语义理解与条款精确定位;仅依赖语义相似检索容易召回语义近似但条款不对应的片段,导致引用不准确;当知识库存在多版本或多来源解释时,结果容易出现冲突且缺乏明确的取舍依据,进而影响结论的可追溯性与审计可用性
分析本发明提供的上述一种基于混合检索增强的知识问答方法及系统可知,在具体应用时,首先,系统获取知识库原始文档,进行格式解析与内容清洗;随后按章、节、条或自然段将文档拆分为独立片段并分配唯一标识,分别构建语义索引和包含层级位置、版本、适用范围等字段的结构化索引,建立两者间的映射关系;同时,依据片段间的章节邻接、版本承接及说明引用等关系建立关联图谱并赋予权重,使每个片段可被精准定位与追溯,为后续上下文扩展和可信度传播提供基础;
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This invention relates to the field of information retrieval and knowledge management technology, specifically to a hybrid retrieval and knowledge question-answering method and system for clause-based knowledge bases such as rule documents, specification documents, operation manuals, and handling guidelines. Background Technology
[0002] In the daily management and production operations of enterprises and government agencies, a large number of rule-based and normative documents are typically generated and maintained over a long period. These documents are often characterized by clear chapter hierarchies, explicit clause numbering, limited scope of application and effective dates, frequent version iterations, and multiple versions and supplementary explanatory documents from different departments, systems, or stages.
[0003] In actual business operations, personnel often need to quickly find information such as "what the corresponding clause is, which version is valid, which scenarios it applies to, what steps need to be taken, and what restrictions or exceptions exist" for specific issues. For example, in scenarios such as operation and maintenance, compliance verification, policy dissemination, and on-site inspections, issues often contain both natural language descriptions and structured constraint elements (such as clause number, version number, effective date, scope of application, and responsible party). Due to the large number of documents, scattered clauses, and cross-referencing between versions, relying on manual retrieval and page-by-page comparison is usually time-consuming and prone to omissions, miscitations, or referencing outdated versions, affecting business processing efficiency and consistency.
[0004] Furthermore, rule documents often involve revision announcements, supplementary explanations, implementation details, and historical versions during long-term maintenance. The same issue may present different expressions or even conflicting conclusions in different sources or versions. Business personnel, when seeking answers, need not only the conclusion itself but also clear clause bases and traceable citation information to meet audit, review, and liability determination requirements. Therefore, in clause-based knowledge base scenarios, balancing "convenient semantic understanding for retrieval" with "precise location of clause elements," and identifying, selecting, and interpreting differences from multiple sources and versions, becomes a pressing practical need for such knowledge service systems.
[0005] In operations, compliance, auditing, and policy enforcement, there are numerous rule-related documents and normative documents with complex hierarchical structures, clearly numbered clauses, and frequent version updates. User questions often include both natural language descriptions and clause information (such as clause number, version, effective date, and scope of application).
[0006] In existing solutions, relying solely on keyword or text matching methods makes it difficult to balance semantic understanding and precise clause location; relying solely on semantic similarity retrieval may easily recall semantically similar but non-corresponding clauses, leading to inaccurate citations; when the knowledge base contains multiple versions or multiple sources of interpretation, the results are prone to conflict and lack clear criteria for selection, thus affecting the traceability and auditability of the conclusions.
[0007] Therefore, there is a need for a knowledge-based question-and-answer solution that can simultaneously utilize clause structure information and textual semantic information, handle conflicts from multiple sources and versions, and output clause references. Summary of the Invention
[0008] The purpose of this invention is to provide a knowledge question answering method and system based on hybrid retrieval enhancement, which solves the above-mentioned technical problems pointed out in the prior art.
[0009] This invention provides a knowledge question answering method based on hybrid retrieval enhancement, comprising the following steps: Obtain the original documents from the knowledge base; after preprocessing the original documents, perform structured splitting and dual-index construction to obtain the semantic index and the structured index, as well as the correspondence between the semantic index and the structured index; After receiving and parsing the user query q, the semantic retrieval path weights are determined based on the user query data of the user query q. Weight of structured retrieval pathway ; Based on semantic retrieval path weights Weight of structured retrieval pathway Determine the search type, and based on the search type and the structural matching terms, determine the set of candidate fragments; The credibility of each candidate fragment in the candidate fragment set is evaluated to obtain the initial credibility; a fragment relationship graph is constructed based on the relationship between fragments, and credibility propagation iteration is performed on the fragment relationship graph to obtain the propagated credibility; the candidate fragments are pruned and sorted according to the propagated credibility to obtain a high-credibility context set. The high-confidence context set is divided into multiple perspective groups according to source type or version number. The candidate conclusions corresponding to different perspective groups under the same problem dimension are aligned and conflicts are detected. If conflicts exist, a consistent conclusion is determined according to the preset priority rules and a difference prompt message is generated. A draft answer is generated based on the user query q, a set of highly reliable contexts, and consistent conclusions. The draft answer is then used to extract conclusions, and evidence fragments are matched for each conclusion item in the set of highly reliable contexts. A closed-loop score is calculated. If the closed-loop score passes a preset threshold, the final question-and-answer result is output. If it fails, the process of regenerating and supplementing the context is executed sequentially. When the termination condition is met, a message indicating insufficient evidence or conflict is output.
[0010] Ideally, user query data should include core semantic components. and set of clause elements The set of clause elements includes one or more of the following constraint information: clause number, version number, effective date, scope of application, and responsible party.
[0011] Preferably, after preprocessing the original document, the semantic index and structured index are obtained through structured splitting and dual-index construction, and the correspondence between the semantic index and the structured index is obtained. This includes the following steps: The original documents in the knowledge base are preprocessed to obtain preprocessed documents. These preprocessed documents are then structurally split according to chapter, section, article, or paragraph boundaries to obtain multiple document fragments, and each document fragment is assigned a unique identifier. ; Construct semantic feature representations for each document fragment and build a semantic index; Build a structured index record for each document fragment; Based on unique identifier Establish a one-to-one correspondence between semantic indexes and structured indexes, and establish relationships between fragments.
[0012] Preferably, a structured index contains at least one or more of the following fields: document identifier, chapter, section, article level position, article number, version number, publication date or effective date, scope of application, and source type; The relationships mentioned include at least one or more of the following: version succession, chapter adjacency, and description reference.
[0013] Preferably, after receiving and parsing the user query q, the semantic retrieval path weights are determined based on the user query data of the user query q. Weight of structured retrieval pathway The operation includes the following steps: Receive user queries For user queries The core semantic part was obtained through parsing. and set of clause elements ; Calculate the core semantic parts respectively The semantic complexity index λ and the structural density index δ of the clause element set; Specifically, the semantic complexity index λ is based on Calculate, where, ; For the core semantic part The number of clauses or phrases segmented. The number of restrictive interrogative words and conditional conjunctions, amb is The percentage of words in the multi-semantic dictionary of the hit domain The proportion of total words , For the normalized upper limit, The weighting coefficients are equal to 1; the structural density index δ of the set of clause elements is based on... Calculate, where M is the total number of preset clause element types, I(i) indicates whether the i-th type of clause element is identified and matched in the user query, and u(i) is the structural weight of the i-th type of clause element and the sum of the structural weights is 1; Both u(i) and u(i) are predetermined based on the historical query calibration set constructed before the system goes online. For specific calibration methods and example values, please refer to the detailed implementation section below.
[0014] The semantic retrieval path weights are determined based on the semantic complexity index λ and the structure density index δ of the clause element set. Weight of structured retrieval pathway .
[0015] Ideally, based on semantic retrieval path weights Weight of structured retrieval pathway Determine the search type, and based on the search type and the structural matching terms, determine the candidate fragment set, including the following steps: Weighting semantic retrieval pathways and structured retrieval pathway weights Each is compared with the same preset retrieval type determination threshold, where 0.5 < θ < 1; if If it is greater than or equal to θ, it is determined to be a semantic retrieval type; if If the value is greater than or equal to θ, it is determined to be a structured search type; if both are less than θ, it is determined to be a mixed search. When performing semantic retrieval or hybrid retrieval, based on the core semantic components Perform vector similarity retrieval on semantic feature representations to obtain a set of semantic candidate segments; When performing structured or hybrid search types, based on the set of clause elements. Construct structured search criteria, perform field matching search in the structured index, and obtain a set of candidate structure fragments; When performing a hybrid retrieval type, the semantic candidate fragment set and the structural candidate fragment set are merged and sorted to obtain a merged and sorted candidate fragment set; when performing a semantic retrieval type, the semantic candidate fragment set is directly used as the merged and sorted candidate fragment set; when performing a structured retrieval type, the structural candidate fragment set is directly used as the merged and sorted candidate fragment set. When the structure retrieval hits a clause fragment, the clause corridor expansion is performed with the hit clause fragment as the center. The expanded corridor candidate fragments are added to the candidate fragment set after fusion and sorting to obtain the candidate fragment set. Merge the corridor candidate segments with the merged and sorted candidate segment set, and remove duplicates according to the unique identifier; for segments that simultaneously have corridor weighted scores... The larger of the two scores, F(c) and F(c), is taken as the unified score U(c). If only one score is available, that score is directly used as U(c). The context length is calculated based on the number of lexical units rather than the number of characters or segments. Let be the sum of the lexical counts of all candidate segments after deduplication. The upper limit of the context lexical units to be assigned to the candidate segment; according to Calculate, where, This represents the maximum number of input lexical units allowed by the current large language model. , , and These are the reserved lexical units for system commands, user queries, prompt word templates, and answer output, respectively. ≤ All candidate fragments are retained at the time; when > At that time, candidate segments are added in descending order of U(c) until adding the next segment would cause the cumulative number of lexical units to exceed [a certain threshold]. And at the same time, ensure that the number of retained fragments does not exceed the number in step S33. This yields a set of candidate fragments. In one example, =6000 lexical units =30; The capacity is dynamically determined based on the context window of the model used and the reserved capacity.
[0016] Preferably, the credibility of each candidate segment in the candidate segment set is evaluated to obtain an initial credibility; a segment relationship graph is constructed based on the relationships between segments, and credibility propagation iteration is performed on the segment relationship graph to obtain the propagated credibility; the candidate segments are pruned and sorted according to the propagated credibility to obtain a high-credibility context set, including the following steps: For each candidate fragment in the candidate fragment set, calculate the initial confidence level based on its source type, version validity, and degree of matching with the query. ;
[0017] Based on the relationships between fragments, nodes and their relationships are selected from the candidate fragment set to construct a candidate fragment relationship graph; and an edge weight is assigned to each type of edge in the candidate fragment relationship graph; the edge weights for version continuation edges, chapter adjacency edges, and description reference edges are 0.9, 0.6, and 0.75, respectively. The edge weights are preset values, and the specific methods of determining these values are detailed in the following implementation section.
[0018] Perform credibility propagation iteration on the candidate fragment relationship graph, let the credibility of each node at the 0th iteration be the initial credibility, and perform iterative update to obtain the target credibility of each node; Set a credibility pruning threshold τ and remove candidate segments with a credibility lower than τ; sort the remaining candidate segments according to their credibility after propagation from high to low, and take the top ones. One is used as a set of highly reliable contexts, among which , The upper limit of the context terms to be assigned to candidate segments, τ represents the average number of lexical units in the remaining candidate segments. If the set is empty, τ is gradually reduced to the preset lower limit and then pruned again. If it is still empty, a message indicating that no reliable evidence was found is output and the generation of a definitive answer is terminated.
[0019] Preferably, the edges of the candidate fragment relationship graph include one or more of version continuation edges, chapter adjacency edges, and description reference edges.
[0020] Preferably, the high-confidence context set is divided into multiple perspective groups according to source type or version number, and candidate conclusions under the same issue dimension are aligned to detect whether there are conflicts. If there are conflicts, a consistent conclusion is determined according to a preset priority rule, and a difference prompt message is generated, including the following operation steps: Based on the source type or version number of each candidate fragment in the high-confidence context set, the candidate fragments are divided into different view groups; For each perspective group, candidate conclusions are extracted based on the question dimensions involved in the user query q. If there is no conflict, the conclusion of the perspective group with the highest credibility after dissemination is selected as the consistent conclusion; if there is a conflict, the consistent conclusion is determined in the order of validity threshold, version priority, source priority, and credibility after dissemination, and a difference prompt message is generated.
[0021] Preferably, the preset priority rules are executed in the following order: validity threshold, version priority, source priority, and credibility priority. First, conclusions that are invalid, not yet effective, have exceeded their expiration time, or do not meet the scope of the query are eliminated. Then, currently valid versions with a later effective time are selected. Next, official releases, departmental regulations, and verifiable external citations are selected in that order. Finally, conclusions with higher credibility after dissemination are selected. Consistent conclusions are selected according to this order, and the conclusion summaries, conflict fields, and reasons for non-adoption of the remaining perspective groups are compiled into difference prompt information.
[0022] Preferably, a draft answer is generated based on the user query q, a set of highly reliable contexts, and consistent conclusions; conclusions are extracted from the draft answer, and evidence fragments are matched for each conclusion item in the set of highly reliable contexts; a closed-loop score is calculated, and if the closed-loop score passes a preset threshold, the final question-and-answer result is output; if it fails, it is processed according to a hierarchical strategy of regenerating, supplementing contexts, and terminating output, including the following steps: The user query q, the text content of each candidate segment in the high-confidence context set, the consistency conclusion, and the difference prompt information are assembled into prompt words, and the large language model is called to generate a draft answer A in natural language; Extract key conclusion items from the draft answer to obtain a conclusion item set H; for each conclusion item, traverse candidate segments in the high-confidence context set and calculate semantic similarity; when the semantic similarity is not lower than the preset matching threshold, the corresponding candidate segment is used as evidence to be judged, and based on the subject, behavior, object, applicable conditions, numerical range and negation polarity to judge support, contradiction or irrelevant relationship, construct a conclusion-evidence relationship matrix M with elements taking values of 1, -1 or 0; The system uses the conclusion item set H and the conclusion-evidence relationship matrix M to statistically analyze coverage, conflict degree, and proportion of unsubstantiated evidence, and calculates the closed-loop score accordingly. A closed-loop score threshold T is set; if the score is greater than or equal to T, the validation is considered successful, and the draft answer is used as the final answer, along with supporting information on the relevant clauses and discrepancies. If the score is less than T, the system sequentially performs regeneration based on the failed conclusion items and context supplementation. Processing terminates when the maximum number of regeneration rounds is reached, no new supporting evidence is obtained, or the context length budget is reached, outputting a message indicating insufficient evidence or conflict, as well as information on the failed conclusion items.
[0023] Accordingly, this invention also proposes a knowledge question answering system based on hybrid retrieval enhancement, including a document modeling and index building module, a query parsing and retrieval routing module, a hybrid retrieval and clause corridor expansion module, a credibility assessment and propagation screening module, a conflict detection and consistency output module, and a result generation and answer-evidence closed-loop verification module. The document modeling and index building module is used to obtain the original documents of the knowledge base. After preprocessing the original documents, it is processed by structured splitting and dual index building to obtain the semantic index and the structured index, as well as the correspondence between the semantic index and the structured index. The query parsing and retrieval routing module receives and parses the user query q, then uses the user query data based on q to solve for and determine the semantic retrieval path weights. Weight of structured retrieval pathway ; Hybrid search and terms corridor extension module, used to calculate semantic search path weights Weight of structured retrieval pathway Determine the search type, and based on the search type and the structural matching terms, determine the set of candidate fragments; The credibility assessment and propagation filtering module is used to assess the credibility of each candidate segment in the candidate segment set to obtain the initial credibility; construct a segment relationship graph based on the relationship between segments, perform credibility propagation iteration on the segment relationship graph to obtain the propagated credibility; and prune and sort the candidate segments according to the propagated credibility to obtain a high-credibility context set. The conflict detection and consistency output module is used to divide the high-confidence context set into multiple perspective groups according to source type or version number, align the candidate conclusions corresponding to different perspective groups under the same problem dimension, and detect whether there is a conflict; if there is a conflict, the consistent conclusion is determined according to the preset priority rules, and difference prompt information is generated. The Result Generation and Answer - Evidence Loop Verification module is used to generate a draft answer based on the user query q, a set of highly reliable contexts, and consistent conclusions. It extracts conclusions from the draft answer, matches them with evidence fragments, and calculates the loop score. If the loop score passes the preset threshold, the final question and answer result is output. If it fails, the context is regenerated and supplemented, and a prompt indicating insufficient evidence or conflict is output when the termination condition is met.
[0024] Compared with the prior art, the embodiments of the present invention have at least the following technical advantages: Analysis of the knowledge question answering method and system based on hybrid retrieval enhancement provided by this invention reveals that, in practical applications, the system first acquires the original documents from the knowledge base and performs format parsing and content cleaning. Then, the documents are split into independent segments by chapter, section, article, or paragraph and assigned unique identifiers. Semantic indexes and structured indexes containing fields such as hierarchical position, version, and scope of application are constructed, establishing a mapping relationship between the two. Simultaneously, a relational graph is established based on the relationships between segments, such as chapter adjacency, version succession, and explanatory references, and weights are assigned, enabling each segment to be accurately located and traced, providing a foundation for subsequent contextual expansion and credibility propagation. When processing user queries, the system parses them into core semantic parts and a set of clause elements (such as clause number, version, effective date, etc.). By calculating semantic complexity and structure density, it dynamically determines the weights of the two paths, semantic retrieval and structured retrieval, to achieve adaptive allocation of retrieval methods. When executing a retrieval, the retrieval type is determined by comparing weights and thresholds: semantic retrieval is based on vector similarity, structured retrieval is based on field matching, and hybrid retrieval combines the two types of results with weights. If a structured retrieval hits a specific clause, the system expands along a corridor within the chapter containing that clause, supplementing adjacent fragments before and after it, ultimately forming a set of candidate fragments that cover precise matching and the surrounding context. Subsequently, the system evaluates the credibility of candidate segments; calculates the initial credibility based on source type, version validity and matching degree, and constructs a candidate segment relationship graph based on existing segment association relationships. The credibility is iteratively propagated on the graph to make the associated segments mutually reinforce each other until convergence; low-credibility segments are removed according to a preset pruning threshold, and the remaining segments are sorted by credibility to select a high-credibility context set. To address potential discrepancies in conclusions arising from multiple sources or versions, the system categorizes highly reliable contexts into different perspective groups based on their source or version. It extracts candidate conclusions from each group for the same problem dimension and performs semantic alignment, detecting conflicts in numerical ranges, applicable conditions, or semantic levels. If no conflicts exist, the conclusion from the group with the highest reliability is selected. If conflicts do exist, a consistent conclusion is determined based on preset priority rules for source, version, or reliability. Simultaneously, summaries of conclusions from other groups and reasons for their rejection are compiled as discrepancy alerts, ensuring that the final conclusion is both authoritative and transparent. Finally, the user query, highly reliable context, consistent conclusions, and discrepancy hints are assembled into prompt words, and a large language model is called to generate a draft answer. Key conclusion items are extracted from the answer, and evidence to be judged is matched for each item. The evidence relationship is judged as supportive, contradictory, or irrelevant, and a three-valued conclusion-evidence relationship matrix is established. Based on this, the coverage, conflict degree, and proportion of unsubstantiated evidence are statistically analyzed, and a closed-loop score is calculated. If the score meets the standard, the final answer is output with the reference to the relevant clauses and discrepancy hints. If the score does not meet the standard, the context is regenerated and supplemented in turn. The process terminates when the round limit is reached, no new evidence is added, or the context budget limit is reached, and a prompt indicating insufficient evidence or conflict is output. This ensures that the answer generation, evidence verification, and failure exit all form a closed loop. Attached Figure Description
[0025] Figure 1 This is a schematic diagram of the overall process of the method in an embodiment of the present invention;
[0026] Figure 2 This is a schematic diagram illustrating document structuring and dual-index construction in an embodiment of the present invention;
[0027] Figure 3This is a schematic diagram illustrating the adaptive determination of query parsing and retrieval strategies in an embodiment of the present invention;
[0028] Figure 4 This is a schematic diagram of the clause corridor expansion in an embodiment of the present invention;
[0029] Figure 5 This is a schematic diagram illustrating the construction of the candidate fragment relationship graph and the credibility propagation screening in an embodiment of the present invention;
[0030] Figure 6 This is a schematic diagram illustrating multi-source / multi-version conflict identification and consistency output in an embodiment of the present invention;
[0031] Figure 7 This is a schematic diagram illustrating the closed-loop verification of result generation and evidence consistency in an embodiment of the present invention. Detailed Implementation
[0032] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. 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.
[0033] The present invention will now be described in further detail with reference to specific embodiments and accompanying drawings.
[0034] Example 1 like Figure 1 As shown, Embodiment 1 of the present invention provides a knowledge question answering method based on hybrid retrieval enhancement, including the following operation steps:
[0035] Step S10: Obtain the original documents of the knowledge base; after preprocessing the original documents, obtain the semantic index and the structured index, as well as the correspondence between the semantic index and the structured index, through structured splitting and dual index construction.
[0036] Step S20: After receiving and parsing the user query q, solve the semantic retrieval path weights based on the user query data of the user query q. Weight of structured retrieval pathway ;
[0037] User query data includes core semantic components. and set of clause elements The set of clause elements includes one or more of the following binding information: clause number, version number, effective date, scope of application, and responsible party;
[0038] Step S30: Based on semantic retrieval path weights Weight of structured retrieval pathway Determine the search type, and based on the search type and the structural matching terms, determine the set of candidate fragments;
[0039] Step S40: Evaluate the credibility of each candidate segment in the candidate segment set to obtain the initial credibility; construct a segment relationship graph based on the relationship between segments, perform credibility propagation iteration on the segment relationship graph to obtain the propagated credibility; prune and sort the candidate segments according to the propagated credibility to obtain a high-credibility context set.
[0040] Step S50: Divide the high-confidence context set into multiple perspective groups according to source type or version number, align the candidate conclusions corresponding to different perspective groups under the same problem dimension, and detect whether there is a conflict; if there is a conflict, determine the consistent conclusion according to the preset priority rule and generate difference prompt information.
[0041] Step S60: Generate a draft answer based on the user query q, the set of highly reliable contexts, and the consistent conclusions; extract the conclusions from the draft answer and match the evidence fragments, and calculate the closed-loop score; if the closed-loop score passes the preset threshold, output the final question and answer result; if it fails, regenerate and supplement the context in sequence, and output a prompt indicating insufficient evidence or conflict when the termination condition is reached.
[0042] It should be noted that in the above embodiments of this application, the original documents of the knowledge base are first obtained; after preprocessing, they are split into document fragments by chapter / section / article / paragraph and assigned unique IDs, and semantic indexes and structured indexes are constructed, and the correspondence between the two is established, that is, the relationship between fragments is established (version inheritance, chapter adjacency, description reference) and the relationship type and weight are set, forming a dual retrieval path of semantics and structure, and each fragment can be located and traced; the relationship provides the foundation for subsequent expansion and credibility propagation;
[0043] Then, the user query q is received and parsed, separating the core semantic part and the set of clause elements (clause number, version, effective date, scope of application, etc.). The semantic complexity of the core semantic part and the structural density of the set of clause elements D are calculated, and the weights of the two paths are determined. The retrieval priority is dynamically adjusted according to the richness of natural language and structured constraints in the query to achieve adaptive path allocation. Then, the logic is executed: based on the semantic retrieval path weights... Weight of structured retrieval pathway The retrieval type is determined by comparison with a threshold; the corresponding retrieval is performed to obtain semantic candidates and / or structural candidates; when mixed, the weighted fusion and sorting are performed; if the structure matches the clause, the clause corridor expansion is performed with the matched clause as the center, the corridor candidates are supplemented and truncated to obtain the final candidate fragment set, generating a candidate set covering semantic matching and exact matching, and supplementing the adjacent context through corridor expansion to improve completeness and coherence;
[0044] Furthermore, for each candidate segment, an initial credibility is calculated based on source type, version validity, and matching degree; nodes and relationships are filtered from the candidate segments to construct a candidate segment relationship graph, and edge weights are set for version continuation edges, chapter adjacency edges, and description reference edges; credibility propagation iterations are performed on the graph until convergence; low-credibility segments are removed according to a pruning threshold, and the remaining segments are sorted by credibility and then... A highly reliable context set is formed within the context lexical budget; if the set is empty, the threshold is gradually lowered to the lower limit and then pruned again. If it is still empty, the generation of a deterministic answer is terminated and a prompt indicating that no reliable evidence was found is output.
[0045] Then, the high-confidence context set is divided into multiple perspective groups according to source type or version number; candidate conclusions are extracted from each group and semantically aligned, and conflicts are detected based on numerical range, applicable conditions and semantic polarity; when there is no conflict, the conclusion of the group with the highest confidence is selected; when there is a conflict, the consistent conclusion is determined in order of validity threshold, version priority, source priority and post-propagation confidence priority, and the conclusion summaries of other groups, conflict fields and reasons for not being adopted are compiled into difference prompt information;
[0046] Finally, the user query, highly reliable context, consistent conclusions, and discrepancy hints are assembled into prompt words, and a large language model is invoked to generate a draft answer. Conclusion items are extracted from the draft answer, and segments with similarity not lower than the matching threshold are further judged to support, contradict, or be irrelevant, constructing a three-valued conclusion-evidence relationship matrix. Coverage, conflict degree, and proportion of unsubstantiated evidence are statistically analyzed, and a closed-loop score is calculated. If the score reaches the threshold, the final answer is output with supporting evidence and discrepancy hints. If the threshold is not reached, constraint regeneration and context supplementation are performed sequentially, terminating when the upper limit of regeneration rounds is reached, no new supporting evidence is obtained, or the context length budget is reached, and a hint of insufficient evidence or conflict is output.
[0047] Specifically, such as Figure 2 As shown, in step S10, after preprocessing the original document, the semantic index and the structured index, as well as the correspondence between the semantic index and the structured index, are obtained through structured splitting and dual-index construction. This includes the following steps:
[0048] Step S11: Preprocess the original documents in the knowledge base to obtain preprocessed documents. Then, structurally split the preprocessed documents according to chapter, section, article, or paragraph boundaries to obtain multiple document fragments, and assign a unique identifier to each document fragment. ;
[0049] It should be noted that the above preprocessing includes format parsing, text extraction, and document content cleaning of the original document (including removing headers, footers, duplicate tables of contents, scanning noise, and invalid whitespace that are not related to the knowledge content, while retaining content that can represent the document structure or meaning of clauses, such as chapters, sections, articles, clauses, items, appendices, definitions, footnotes, and table titles).
[0050] Step S12: Construct semantic feature representations for each document fragment and build a semantic index (for subsequent semantic similarity retrieval);
[0051] It should be noted that the above-mentioned construction of semantic feature representation is achieved by generating a semantic feature representation for each document fragment with a unique identifier based on the text content of the document fragment. The semantic index is obtained by establishing a correspondence between the semantic feature representation of the document fragment and the unique identifier of the document fragment, and storing the semantic feature representation of the document fragment after establishing the correspondence in the semantic index. The constructed semantic feature representation is used to ensure that the semantic feature representation of the document fragment simultaneously includes the semantic content and structural context of the document fragment. The semantic index is used to perform semantic similarity retrieval on the document fragment based on the semantic similarity between the user query and the document fragment.
[0052] Step S13: Build a structured index record for each document fragment;
[0053] A structured index must contain at least one or more of the following fields: document identifier, chapter, section, clause level, clause number, version number, publication date or effective date, scope of application, and source type;
[0054] It should be noted that in the above embodiments of this application, a structured index record is generated based on the document fragment attribute information, a correspondence is established between the structured index record and the unique identifier of the document fragment, and the structured index record after the correspondence is established is stored in the structured index to obtain the structured index, which is used to perform field matching retrieval on the document fragment based on at least one of the clause number, version number, effective time, scope of application, source type or status identifier.
[0055] Step S14: Based on unique identifier Establish a one-to-one correspondence between semantic indexes and structured indexes, and establish relationships between fragments. These relationships include at least one or more of the following: version succession, chapter adjacency, and description reference.
[0056] It should be noted that, specifically, the above-described embodiments of this application establish associations between document fragments based on their chapter level positions, version numbers, clause numbers, and reference relationships within the document fragment content. These associations include at least chapter adjacency relationships, version succession relationships, and explanatory reference relationships. Specifically, chapter adjacency relationships represent the relationship between adjacent document fragments within the same chapter level; version succession relationships represent the relationship between document fragments with the same clause number or the same clause topic in different versions; and explanatory reference relationships represent the relationship where one document fragment references, explains, supplements, or limits another document fragment. Fragment relationship records are established based on these associations, and an association type and weight are set for each association, resulting in fragment associations with association types and weights. The association weight represents the strength of the corresponding fragment association. A correspondence is established between semantic indexes, structured indexes, and fragment associations using the unique identifier of each document fragment, enabling each document fragment to be located and traced within the semantic index, structured index, and fragment associations using its unique identifier.
[0057] The above-described embodiments of this application first preprocess the original document, then structurally split it according to chapter, section, article or paragraph boundaries to obtain multiple document fragments, assigning a unique ID to each, thus transforming the unstructured document into fragment units that can be independently retrieved and referenced;
[0058] Next, a semantic feature representation (containing semantic content and structural context) is generated for each document fragment. This representation is then mapped to the fragment ID and stored in the semantic index for subsequent semantic similarity retrieval, establishing a semantic retrieval pathway and supporting query matching based on vector similarity.
[0059] Furthermore, a structured index record is constructed for each document fragment, which includes at least the following fields: document identifier, hierarchical position, clause number, version number, publication time / effective time, scope of application, and source type. After being associated with the ID, it is stored in the structured index for field matching retrieval, establishing a structured retrieval path and supporting precise field condition filtering.
[0060] Then, a one-to-one correspondence between semantic index and structured index is established based on fragment ID; at the same time, the relationship between fragments (chapter adjacency, version succession, description reference) is established according to chapter level, version number, clause number and reference relationship, and the relationship type and weight are set so that each fragment is uniformly located in the two types of indexes and relationships, providing links for cross-path integration and relationship propagation.
[0061] Specifically, in step S20, after receiving and parsing the user query q, the semantic retrieval path weights are determined based on the user query data of the user query q. Weight of structured retrieval pathway The operation includes the following steps:
[0062] Step S21: Receive user query q, and parse user query q to obtain the core semantic part. And the set of clause elements D, wherein the set of clause elements D includes one or more of the following binding information: clause number, version number, effective date, scope of application, and responsible party;
[0063] It should be noted that, in the above embodiments of this application, the user query can be an unanswered question described by the user in natural language, or it can simultaneously include natural language description and clause elements such as clause number, version number, effective date, or scope of application. The core semantics of the query are used to represent the facts, conditions, rules, operations, or handling requirements that the user query seeks to resolve. The set of clause elements is used to represent the structured constraint information parsed from the user query, and the set of clause elements includes at least one or more of the clause number, version number, effective date, and scope of application.
[0064] Step S22: Calculate the core semantic parts respectively. The semantic complexity index λ and the structural density index δ of the clause element set;
[0065] Specifically, the semantic complexity index λ is calculated as follows: ;
[0066] in, ; For the core semantic part The number of clauses or phrases segmented. The number of restrictive interrogative words and conditional conjunctions, amb is The percentage of words in the multi-semantic dictionary of the hit domain The proportion of total words , For the normalized upper limit, , , The weighting factor is equal to 1. The structural density index δ of the set of clause elements is determined according to... Calculate, where M is the total number of preset clause element types, I(i) indicates whether the i-th type of clause element is identified and matched in the user query, and u(i) is the structural weight of the i-th type of clause element and the sum of the structural weights is 1; , , , , Both u(i) and u(i) are pre-determined based on the historical query calibration set constructed before the system went live. Specific calibration methods and example values are detailed in the detailed implementation section below. Regarding the core semantic part... Perform word segmentation and syntactic dependency analysis to obtain Number of clauses or phrases segmented in And the number of restrictive interrogative words and conditional conjunctions According to the domain polysemous thesaurus statistics The percentage of words that hit this word list The proportion of total words, amb, has a value ranging from [0,1]. It is calculated according to the upper limit of normalization. , right , Normalization is performed to obtain , and in accordance with Calculate the semantic complexity index λ; where, , Both AMB and 'amb' are derived from the core semantic part of the current user's query 'q'. Obtained directly by calculation; , This is the upper limit of normalization; , , These are the weighting coefficients corresponding to clause structural complexity, restrictive modification complexity, and semantic ambiguity, respectively. + + =1; The domain polysemous vocabulary is formed by manually reviewing domain terms, synonyms, and business terms from the knowledge base. , , , , The parameters are derived from the historical query calibration set built before the system went live: domain personnel annotate the query statements in the calibration set with applicable semantic retrieval, structured retrieval or hybrid retrieval strategies; , Take the calibration set respectively , The positive integer obtained by rounding up the 95th percentile of the statistical distribution; , , Within the range [0,1] and satisfying that the sum of the weights is 1, a grid search is used to select the weight combination that maximizes the consistency between the retrieval strategy's determination and the manually labeled results; in one example, =5, =5, =0.4, =0.3, =0.3.
[0067] Specifically, the structural density index δ of the clause element set is calculated as follows: A clause element type set E={e1,e2,…,eM} is pre-established based on the fields in the structured index that can be used to locate clauses, where M is the total number of clause element types. In this embodiment, E includes the clause number, version number, effective date, scope of application, and responsible party, and M=5. Regular expression matching and named entity recognition are performed on the user query q to obtain the actual matched clause element set D, and then calculated according to δ= Calculate the structural density index δ. Where I(i) is the hit indicator function, when the i-th type of clause element e... i Identified and e i When ∈D, I(i)=1, otherwise I(i)=0; u(i) is the structural weight of the i-th type of clause element, u(i)∈[0,1] and =1. M and the types of each clause element are derived from the field definitions of the structured index in the knowledge base; I(i) is directly determined by the identification result of the current user query q; the parameters of u(i) come from the historical query calibration set built before the system went live. By removing one clause element at a time, the decrease in the correct hit rate of structured retrieval is measured, and the decrease is normalized to obtain the corresponding initial structure weights, which are then reviewed and confirmed by domain personnel in conjunction with the clause positioning rules. In one example, the u(i) corresponding to the clause number, version number, effective time, scope of application, and responsible entity are 0.35, 0.25, 0.15, 0.15, and 0.10, respectively.
[0068] Step S23: Determine the semantic retrieval path weights based on the semantic complexity index λ and the structure density index δ of the clause element set. Weight of structured retrieval pathway ;
[0069] The semantic retrieval path weight is calculated as follows: ;
[0070] Where σ(x) = 1 / (1 + e⁻ˣ), σ(x) is the Sigmoid function, used to map any real number x to the interval (0,1), and e is the natural constant; a is the gain coefficient of the semantic complexity index λ, and b is the gain coefficient of the structure density index δ. Both a and b are greater than 0 to ensure... The parameters a, b, and c increase with increasing λ and decrease with increasing δ; c is a bias term used to adjust the basic balance position of the two retrieval paths. The values of a and b range from (0,5], and the value of c ranges from [-2,2]. The parameters a, b, and c are derived from the historical query calibration set built before the system went live: the queries in the calibration set were labeled as semantic retrieval, structured retrieval, or hybrid retrieval by domain personnel. The goal was to minimize the cross-entropy between the retrieval type determination result and the manual labeling result. Within the above value range, constrained logistic regression was used for fitting, and the final parameters were determined through the validation set. In one example, a=2, b=2, c=0. At this time, when λ and δ are equal, = =0.5.
[0071] The calculation method for the weight of structured retrieval pathways is as follows: ;
[0072] It should be noted that semantic retrieval path weight and structured retrieval pathway weights This is used simultaneously for the retrieval type determination in step S31 and the result fusion in step S33. Step S31 uses a preset retrieval type determination threshold θ and divides it into three routing states: when... When ≥θ, the semantic retrieval path has a high priority and is determined to be a semantic retrieval type; when When ≥θ, the structured retrieval path has a high priority and is determined to be a structured retrieval type; when <θ and When θ < θ, both paths have equal priority, indicating a mixed retrieval type. Because + =1, the three states are mutually exclusive. In one example, θ=0.6, corresponding to When the value is ≥0.6, semantic retrieval is used. Structured search is used when the value is ≤0.4; 0.4 < When the threshold is less than 0.6, a hybrid retrieval is used. θ is determined by the historical query calibration set: the threshold that maximizes the consistency between the retrieval type determination result and the manually labeled result is selected from the candidate threshold set. In step S33, when performing the hybrid retrieval, no further discrete priority is set; instead, the threshold is directly used. and It serves as the fusion coefficient between semantic similarity score and structural matching score.
[0073] It should be noted that in the above embodiments of this application, the user query q is first received, and the core semantic part (facts, conditions, rules, etc.) and the set of clause elements D (clause number, version, effective time, scope of application, etc.) are parsed to obtain the core semantic part (facts, conditions, rules, etc.) and the clause element set D (clause number, version, effective time, scope of application, etc.) are decomposed into two types of input information required for semantic retrieval and structured retrieval.
[0074] Next, the semantic complexity index λ of the core semantic part and the structural density index δ of the clause element set are calculated respectively to provide a quantitative basis for subsequent weight calculation;
[0075] Then, the semantic retrieval path weights are calculated based on the semantic complexity index λ and the structure density index δ. and structured retrieval pathway weights In step S31, the two weights are compared with the retrieval type determination threshold θ to determine the three routing states: semantic retrieval, structured retrieval, or hybrid retrieval. In the hybrid retrieval state in step S33, the weights are directly determined by... and As a fusion coefficient of the two types of normalized search scores, the weight calculation results can be practically applied in subsequent search type determination and fusion ranking.
[0076] Specifically, in step S30, based on the semantic retrieval path weights... Weight of structured retrieval pathway Determine the search type, and based on the search type and the structural matching terms, determine the candidate fragment set, including the following steps:
[0077] Step S31: Weight the semantic retrieval pathway and structured retrieval pathway weights Each is compared with the same preset retrieval type determination threshold θ, where 0.5 < θ < 1; if If ≥θ, it is determined to be a semantic retrieval type; if If ≥θ, it is determined to be a structured search type; if <θ and If the value is less than θ, it is determined to be a mixed search type; in one example, θ = 0.6;
[0078] When performing semantic retrieval or hybrid retrieval, based on the core semantic components Perform vector similarity retrieval on the semantic feature representation to obtain a set of semantic candidate segments;
[0079] It should be noted that the above embodiments of this application are based on the core semantic part of the user query q. Generate a query semantic feature representation and calculate the cosine similarity between this query semantic feature representation and the semantic feature representations of each document fragment obtained in step S12; select documents with similarity not lower than the semantic recall threshold. The document fragments are filtered into semantic candidate fragments. In one example, =0.78; Within the range of [0.70, 0.90], a grid search is performed using a historically labeled question-and-answer verification set with a step size of 0.02, and the target is determined by the highest F1 score for semantic candidate fragment evidence recall.
[0080] Step S32: When performing a structured search or a mixed search, based on the set of clause elements. Construct structured search criteria, perform field matching search in the structured index, and obtain a set of candidate structure fragments;
[0081] It should be noted that step S32 constructs structured search conditions and performs field matching search as follows: First, the element values in the clause element set D are standardized, converting Chinese numeric clause numbers to a unified number format, version numbers to a preset version code, and dates to a unified date format. Synonyms are mapped to standard values based on the scope of application dictionary and the responsible entity dictionary. Then, the clause number, version number, effective date, scope of application, and responsible entity are mapped to their corresponding fields in the structured index. Specifically, the clause number and version number use exact matching, the effective date uses range inclusion matching, and the scope of application and responsible entity use standard value exact matching or hierarchical matching. Logical AND is used between different element types, and logical OR is used when the same element type contains multiple candidate values. For any document fragment d in the structured index, according to... Calculate the structure matching score, where I(i) and u(i) follow the definitions in step S22. For the field matching result of the i-th clause element, the value is 1 if there is a match and 0 if there is no match; when the denominator When =0, it indicates that the current query did not identify any available clause elements, so structured field matching is not performed and the set of candidate structure fragments is set to empty. First, document fragments that do not meet version validity or effective time constraints are removed, and then... Sort the fragments from highest to lowest to obtain a set of candidate fragments for the structure.
[0082] Step S33: When performing a hybrid retrieval type, the semantic candidate fragment set and the structural candidate fragment set are merged and sorted to obtain a merged and sorted candidate fragment set; when performing a semantic retrieval type, the semantic candidate fragment set is directly used as the merged and sorted candidate fragment set; when performing a structured retrieval type, the structural candidate fragment set is directly used as the merged and sorted candidate fragment set.
[0083] It should be noted that, in the above embodiments of this application, when performing mixed retrieval types, the semantic retrieval path weight is used as a basis. Weight of structured retrieval pathway For each candidate segment d in the semantic candidate segment set and the structural candidate segment set, calculate the fusion ranking score F(d), and the calculation formula is as follows: .in, The semantic similarity normalization score of candidate segment d. The structure matching normalization score of candidate fragment d is used, with both scores ranging from [0,1]. For a candidate fragment that appears only in one candidate set, its normalization score in the other candidate set is recorded as 0. Candidate fragments are sorted from highest to lowest according to F(d), and the top K candidate fragments are retained. If the total number of candidate fragments is less than K, all fragments are retained. K is dynamically determined based on the available context capacity, calculated as follows: ,in, The maximum number of lexical units allocated to candidate segments after deducting the capacity reserved for user queries, suggestion word templates, and output in the context window of a large language model. This represents the average number of lexical units in this candidate segment. and These represent the lower and upper limits for the number of candidates, respectively. In one example, =10、 =30、 =6000; and The algorithm is pre-calibrated using a historical question-and-answer validation set, with the goal of optimizing the combined metrics of evidence recall and the proportion of irrelevant fragments. Therefore, K primarily varies dynamically with the available context capacity and the average fragment length, rather than being determined solely by the knowledge base size or the total number of document fragments. and In step S33, the contribution ratios of semantic retrieval results and structured retrieval results to the fusion ranking are controlled respectively.
[0084] Step S34: When the structure retrieval hits a clause fragment, perform clause corridor expansion with the hit clause fragment as the center, and supplement the expanded corridor candidate fragments into the candidate fragment set after fusion and sorting to obtain the candidate fragment set;
[0085] It should be noted that, in the above embodiments of this application, the structure retrieval hitting clause fragment refers to the following steps: the structure candidate fragment set is not empty in step S32; the clause fragment with the highest matching degree is selected from the structure candidate fragment set as the hitting clause fragment; based on the same section or chapter where the hitting clause fragment is located, all document fragments within that scope are obtained and arranged according to clause number or paragraph order; and the process is expanded forward from the hitting clause fragment as the center. Adjacent clause segments and expand backward When adjacent clause fragments are located at chapter boundaries and there are insufficient actual adjacent fragments, only the existing adjacent fragments are retained; optionally, general provisions, supplementary provisions, or explanatory fragments from the same chapter can be introduced, and these fragments are deduplicated and used as corridor candidate fragments. In one example, =2 and =2, which means extending two adjacent clause segments forward and backward respectively. and The candidate values range from 1 to 5, and their parameters are derived from historical question-and-answer verification sets. For different expansion quantities, the evidence fragment recall rate, irrelevant fragment ratio, and context usage are statistically analyzed. The combination of values that has the highest evidence fragment recall rate and the irrelevant fragment ratio not exceeding a preset upper limit under the context capacity constraint is selected. In the verification results of this embodiment, the following values are selected: = =2. Calculate the corridor-weighted score for each candidate corridor segment, using the following method: ;
[0086] Where c represents any candidate segment of the corridor. `base(c)` represents the core clause fragment hit by the structured retrieval; `base(c)` is the basic retrieval score of fragment `c` before corridor expansion: `F(c)` is used when `c` has a fusion ranking score `F(c)`, `F(c)` is used when only a semantic similarity normalized score or a structure matching normalized score exists, and `0` is used when only introduced by corridor expansion and no original retrieval score exists; `dist(c,` () is fragment c and the central clause fragment The interval count is calculated according to clause number or paragraph order within the same section or chapter. The interval count for the central clause is 0, and the interval count for the segment directly adjacent to the central clause is 1. η is the corridor expansion gain coefficient, η∈[0,1], used to control the maximum gain of the central clause's association relationship on the corridor candidate segments. κ is the distance decay coefficient, κ∈(0,2], used to control the rate at which the gain decays as the number of clause intervals increases. exp(·) is an exponential function with the natural constant e as the base. The parameters of η and κ are derived from the historical question-and-answer validation set: a grid search is performed within the above value range, and the parameters are determined with the highest weighted evaluation value of the evidence segment recall rate and the proportion of irrelevant segments as the objective. In one example, η=0.3 and κ=0.5; at this time, the central clause obtains a gain of 0.3, and the gains of other corridor segments increase with dist(c, The increase in [something] shows an exponential decay.
[0087] Merge the corridor candidate segments with the merged and sorted candidate segment set, and remove duplicates according to the unique identifier; for segments that simultaneously have corridor weighted scores... For segments with the combined sort score F(c), the larger of the two scores is taken as the unified sort score U(c). If only one score is available, that score is directly used as U(c). The context length is calculated based on the number of lexical units rather than the number of characters or segments. Let be the sum of the lexical counts of all candidate segments after deduplication. The upper limit of the context lexical units to be assigned to the candidate segment; according to Calculate, where, This represents the maximum number of input lexical units allowed by the current large language model. , , and These are the reserved lexical units for system commands, user queries, prompt word templates, and answer output, respectively. ≤ All candidate fragments are retained at the time; when > At that time, candidate segments are added in descending order of U(c) until adding the next segment would cause the cumulative number of lexical units to exceed [a certain threshold]. And at the same time, ensure that the number of retained fragments does not exceed the number in step S33. This yields a set of candidate fragments. In one example, =6000 lexical units =30; The capacity is dynamically determined based on the context window of the model used and the reserved capacity.
[0088] It should be noted that the above embodiments of this application first assign semantic retrieval path weights. and structured retrieval pathway weights Compare with the retrieval type determination threshold θ respectively: If If ≥θ, then semantic retrieval is used. If the retrieval value is greater than or equal to θ, a structured search is used; if both are less than θ, a hybrid search is used. When performing semantic or hybrid searches, the core semantic component is used. Perform vector similarity retrieval, selecting samples with similarity scores not lower than the semantic recall threshold. The fragments form a semantic candidate fragment set, where θ and The numerical values and calibration methods are described in step S31 and the semantic candidate fragment recall instructions, respectively.
[0089] Next, when performing structured or hybrid retrieval, structured retrieval conditions are constructed based on the set of clause elements D. Field matching retrieval is performed in the structured index to obtain a set of candidate structure fragments and obtain candidate fragments based on precise field matching.
[0090] Furthermore, in hybrid retrieval, semantic candidates and structural candidates are calculated and ranked according to their respective weights. If they appear in both sets, they are added together; if they appear in only one set, the other item is 0. The top few are ranked according to their scores. In semantic retrieval or structured retrieval, the corresponding set is directly taken as the fused and ranked set. The two types of retrieval results are merged and ranked in a unified manner to provide a candidate list for comprehensive ranking in subsequent steps.
[0091] Finally, when the structural retrieval matches a clause fragment (i.e., the structural candidate is not empty), the fragment with the highest matching degree is taken as the central clause, and the fragments within its section or chapter are obtained and sorted. Two adjacent clauses are extended forward and backward from the central clause, and general provisions, supplementary provisions, or explanatory fragments can be introduced. A corridor weighted score is calculated based on the basic retrieval score and the number of clause intervals. After merging and deduplicating the corridor candidate fragments with the merged and sorted candidate fragment set, they are sorted according to a unified ranking score, and the upper limit of the contextual terminology allocated to the candidate fragments is used. and the upper limit of the number of candidates The fragments are truncated to obtain a set of candidate fragments. Through the above processing, the adjacent context of the hit clause is introduced within the available context capacity, avoiding the return of only isolated fragments.
[0092] Specifically, in step S40, the credibility of each candidate segment in the candidate segment set is evaluated to obtain an initial credibility; a segment relationship graph is constructed based on the inter-segment correlation, and credibility propagation iteration is performed on the segment relationship graph to obtain the propagated credibility; the candidate segments are pruned and sorted according to the propagated credibility to obtain a high-credibility context set, including the following operation steps:
[0093] Step S41: For each candidate fragment in the candidate fragment set, calculate the initial confidence level based on its source type, version validity, and degree of matching with the query. ;
[0094] Initial credibility The calculation method is as follows: ;in, As a weight for the credibility of the source, Score the source credibility of candidate fragment i. As a version validity weight, Score the version validity of candidate fragment i. To match weights, Score the match between candidate fragment i and the query;
[0095] It should be noted that in the above embodiments of this application, the source credibility score src(i) ranges from [0,1]. In one example, src(i) = 1.0 when the source type is an official release, src(i) = 0.9 when the source type is a departmental regulation, and src(i) = 0.7 when the source type is an external citation. The above scores are set from high to low according to the authority of the publishing entity, the traceability of the content, and the verifiability of the version, and are calibrated by the ranking effect on the historical question-and-answer verification set and the calibration results of domain experts. The version validity score ver(i) is determined based on the status identifier and effective time in the structured index: ver(i) = 1 when the status identifier is valid, the effective time is not later than the current system time, and the expiration time is empty or later than the current system time; otherwise, ver(i) = 0. The matching score match(i) adopts the fusion ranking score or corridor weighted score of the candidate fragments and is linearly normalized to [0,1]. In one example, =0.4、 =0.3、 =0.3, and the sum of the three is 1; the above weights are determined by performing a grid search on the historical labeled question and answer verification set, with the goal of maximizing the weighted evaluation value of the credible fragment recall rate and ranking index, and can be adjusted according to the specific business to emphasize the authority of the source, the timeliness of the version, or the relevance of the query.
[0096] Step S42: Based on the relationships between fragments, select nodes and the relationships between nodes from the candidate fragment set, and construct a candidate fragment relationship graph;
[0097] The edges of the candidate fragment relationship graph include one or more of version succession edges, chapter adjacency edges, and description reference edges, and an edge weight is set for each type of edge; in one example, the edge weight of the version succession edge is 0.9, the edge weight of the chapter adjacency edge is 0.6, and the edge weight of the description reference edge is 0.75.
[0098] The edge weights are used to characterize the propagation strength of different types of relationships during the credibility propagation iteration process. Their values are preset values greater than 0 and less than or equal to 1. Specifically: the edge weight of version-connecting edges is preset to 0.9, used to characterize the high confidence level corresponding to the connection between the same clause in different version documents; the edge weight of chapter-adjacent edges is preset to 0.6, used to characterize the confidence level corresponding to the contextual connection between adjacent clauses within the same chapter; and the edge weight of descriptive citation edges is preset to 0.75, used to characterize the confidence level corresponding to the explicit citation connection between a clause and its descriptive citation content. The specific values of the above edge weights are determined through ablation experiments and human expert labeling on a pre-constructed annotated corpus: for different combinations of edge weight values, credibility propagation iterations are performed respectively, and the correlation between the target credibility obtained after iteration convergence and the manually annotated credibility is compared. The set of edge weight values with the highest correlation is selected as the preset value. In other embodiments, those skilled in the art can also adjust the above edge weight values according to specific application scenarios.
[0099] Step S43: Perform credibility propagation iteration on the candidate fragment relationship graph, let the initial credibility of each node be the initial credibility calculated in step S41, and perform iterative update to obtain the target credibility of each node;
[0100] Perform confidence propagation iterations on the candidate fragment relationship graph, setting the initial confidence of each node to the initial confidence calculated in step S41, and iteratively updating the confidence of each node, specifically including:
[0101] Repeat the following confidence update: the new confidence of each node equals its initial confidence multiplied by the damping coefficient α, plus (1-α) multiplied by the weighted sum of the old confidences of all neighboring nodes after edge weight normalization; continue until the maximum change in confidence of all nodes is less than the convergence threshold ε, then stop the iteration and obtain the propagated confidence. In one example, α=0.6, ε= The possible ranges for α are [0.4, 0.8], and the possible ranges for ε are [...]. The above values were determined through a grid search on a historical annotated question-and-answer validation set, with the selection criteria being the highest correlation between the post-propagation credibility and the credibility of the manually annotated values, the number of iterations meeting real-time requirements, and stable ranking results for two consecutive rounds. The calculation method is as follows: When the convergence condition is met The iteration stops when t is reached; in the formula, i is the index of the candidate fragment node, and t is the number of iterations. The damping coefficient is... The initial confidence level of node i obtained in step S41. Let be the confidence level of node i in the t-th iteration. Let be any neighboring node of node i. Let be the set of neighboring nodes of node i. Let be the edge weight between node i and node j. For the normalized index in the set of neighboring nodes, Let be the edge weight between node i and node k. Let be the confidence level of node j in the t-th iteration. This is the preset convergence threshold.
[0102] Step S44: Set a confidence pruning threshold τ and remove candidate segments with a confidence level lower than τ; in one example, τ = 0.60. τ is calibrated using a historical labeled question-and-answer validation set: a search is performed in the range [0.40, 0.80] with a step size of 0.05, aiming to maximize the harmonic mean of precision and recall for high-confidence segments. The remaining candidate segments are sorted from highest to lowest confidence level after propagation, and the top-ranked segments are selected. One is used as a set of highly reliable contexts, among which , The upper limit of the context terms to be assigned to candidate segments, This represents the average number of lexical units in the remaining candidate segments; therefore, the upper limit of the high-confidence context set is 20 in one example, and it decreases dynamically based on the average length of the candidate segments and the available lexical unit budget. If there are insufficient remaining candidate segments... If there are 100 highly reliable contexts, all of them will be retained; if the highly reliable context set is empty, τ will be reduced by 0.05 each time and the tree will be pruned again, down to a minimum of 0.40; if it is still empty, a message indicating that no reliable evidence was found will be returned and no definitive answer will be generated.
[0103] It should be noted that in the above embodiments of this application, firstly, for each candidate segment, a source credibility score is given according to the source type (official, departmental regulations, external citation, etc.), and a version validity score is given according to the status identifier and effective time (1 for valid and 0 otherwise). The fusion ranking score or corridor weighted score is used as the matching score. The initial credibility is obtained by weighting the three items and generating an initial credibility value for each candidate segment as the basis for subsequent propagation.
[0104] Then, based on the relationships between fragments, nodes and their associated edges (version succession, chapter adjacency, and description reference) are selected from the candidate fragments, and edge weights are set for each type of edge. A candidate fragment relationship graph is constructed, and the candidate fragments are organized into a weighted graph structure to facilitate the propagation of credibility along the relationships.
[0105] Next, the initial credibility of each node is set to the calculated result of S41, and the target credibility is obtained by iterative update. Credibility is then allowed to flow between related segments through relation propagation, which enhances the credibility of highly related segments and weakens isolated or low-related segments.
[0106] Finally, a pruning threshold τ is set to remove candidate segments with a target credibility lower than τ; the remaining segments are sorted from high to low credibility after propagation, and the first specified number are taken as a high-credibility context set (if there are not enough, all are kept, and if it is empty, the corresponding processing is performed), and finally high-quality, high-credibility context segments are selected for use in answer generation.
[0107] Specifically, in step S50, the high-confidence context set is divided into multiple perspective groups according to source type or version number, and candidate conclusions under the same issue dimension are aligned to detect whether there are conflicts; if there are conflicts, a consistent conclusion is determined according to a preset priority rule, and a difference prompt message is generated, including the following operation steps:
[0108] Step S51: Based on the source type or version number of each candidate fragment in the high-confidence context set, divide the candidate fragments into different view groups;
[0109] Each view group contains candidate segments with the same source type or version number.
[0110] Step S52: For the question dimensions involved in the user query q, extract candidate conclusions under each perspective group for that dimension;
[0111] The candidate conclusions are obtained through a combination of rule-based pre-screening and structured extraction using a large language model: First, each candidate segment is divided into sentences, and candidate sentences are located using numerical values and units, conditional conjunctions, negation words, obligation or permission words, and conclusion indicator words; then, the candidate sentences and their adjacent sentences are input into the large language model, which outputs a structured conclusion based on preset fields, consisting of the subject, behavior or conclusion, object, applicable conditions, exception conditions, numerical range, unit, effective time, and original text position. The large language model uses deterministic decoding with a temperature parameter set to 0; a candidate conclusion is retained only if each field can refer back to the continuous original text and start and end positions in the candidate segment, otherwise it is discarded. Semantic alignment is performed on candidate conclusions from different perspective groups: when the cosine similarity of the core semantic vectors is not less than 0.80, and the subject and object are consistent or synonymous, they are determined to be aligned conclusions under the same question dimension. After alignment, conflicts are determined according to the following rules: First, convert the units to a unified dimension. If, under the same applicable conditions, the intersection of two numerical intervals is empty, or the relative difference between two single-point values is greater than 5%, a numerical conflict is determined. Second, if the sets of enumerated values required by the same condition field do not intersect, or the intersection of time, quantity, or range constraint intervals is empty, the applicable conditions are determined to be mutually exclusive. Third, if the subject, behavior, and object are the same but the affirmative or negative polarities are opposite, or the probability of contradiction in natural language inference is not less than 0.80, the semantics are determined to be opposite. A conflict is determined if any one of these rules is met. The aforementioned 0.80 and 5% thresholds are determined through a grid search on the labeled conflict validation set, aiming to achieve the highest F1 score for conflict identification, and can be adjusted according to business tolerance.
[0112] Step S53: If there are no conflicts, select the conclusion of the perspective group with the highest credibility as the consistent conclusion; if there are conflicts, determine the output conclusion in the order of validity threshold, version priority, source priority, and credibility priority. First, remove conclusions that are invalid, not yet effective, have exceeded their expiration time, or do not meet the scope of the query. Second, for conclusions in the same policy or clause version chain, prioritize the version that is currently in effect and has a later effective time; if the effective time is the same, prioritize the version number with the higher number. Third, if the version conditions are the same, select the source in the order of official release, departmental regulations, and verifiable external citations. Finally, if the version and source are still the same, select the conclusion with higher credibility after dissemination; if they are still the same, select the one with the higher query matching score. Select the conclusion of one perspective group as the consistent conclusion according to the above priority order, and compile the conclusion summaries, conflict fields, and reasons for not being adopted from the remaining perspective groups into difference prompt information.
[0113] It should be noted that in the above embodiments of this application, the candidate segments are first divided into different view groups according to the source type or version number of each candidate segment. The source type or version number is the same in each group, forming multiple independent view context groups.
[0114] Then, for the question dimensions involved in the user query, a combination of rule pre-screening and structured extraction using a large language model is used to extract candidate conclusions that can be referenced back to the original text from each perspective group. The candidate conclusions are semantically aligned, and conflicts are determined based on numerical range, applicable conditions, and semantic polarity. If there are no conflicts, the conclusion of the perspective group with the highest credibility is selected as the consistent conclusion; if there are conflicts, the consistent conclusion is determined according to the following rules in sequence: validity threshold, version priority, source priority, and credibility priority after dissemination. At the same time, the summaries of the remaining conclusions, conflict fields, and reasons for not being adopted are compiled to form a difference prompt message.
[0115] Specifically, in step S60, a draft answer is generated based on the user query q, the set of highly reliable contexts, and the consistency conclusion; the draft answer is then subjected to conclusion extraction and evidence fragment matching to calculate the closed-loop score; if the closed-loop score passes the preset threshold, the final question-and-answer result is output; if it fails, it is processed according to a hierarchical strategy of regenerating, supplementing context, and terminating output, including the following steps:
[0116] Step S61: Assemble the user query q, the text content of each candidate segment in the high-confidence context set, the consistency conclusion, and the difference hint information into a prompt word, and call the large language model to generate a draft answer A. In one example, the large language model is Qwen2.5-72B-Instruct, the model version is Qwen2.5, and the weight identifier is Qwen2.5-72B-Instruct; the temperature parameter is set to 0.2 during generation, and the present invention is not limited to this model. The prompt template is organized in the following order: [System Instruction] You are a rule document Q&A assistant. You can only answer based on the given evidence and cannot add facts that do not exist in the evidence; [User Query] Enter the user query q; [Consistency Conclusion] Enter the consistency conclusion obtained in step S53; [Difference Prompt] Enter the differences between different sources or versions and the reasons for not adopting them; [Evidence Fragments] List each candidate fragment in the order of evidence identifier, document identifier, clause number, version number, source type, credibility, and original content; [Generation Requirements] Answer the user's questions item by item. Each factual conclusion must cite at least one evidence identifier. If there is a conflict, retain the difference explanation. If the evidence is insufficient, explicitly output that the evidence is insufficient; [Output Format] Output a JSON object containing the fields of answer, conclusions, differences, and insufficient evidence. Each item in the conclusions field contains a claim, scope, exception, and evidence IDs. The content in the answer field is used as the natural language draft answer A.
[0117] Step S62: Extract key conclusion items from the draft answer A to obtain a conclusion item set H. The conclusion items are extracted using a combination of structured output from a large language model and rule validation: The same large language model is called and a JSON structured output mode is used to split the draft answer into fields for subject, behavior or conclusion, object, applicable conditions, exception conditions, numerical values, units, and the original text position of the answer; only conclusion items that can refer back to the continuous original text and start and end positions of the draft answer are retained, and the corresponding fields are validated using rules for numerical values, units, negation words, and conditional connectors. For each conclusion item... Traverse candidate fragments in a set of highly reliable contexts Calculate the cosine similarity between the semantic vectors of the two entities; when the similarity is not lower than the matching threshold... At that time, As evidence to be determined. In one example, =0.82; This threshold, within the range of [0.70, 0.90], is determined by a grid search using a labeled conclusion-evidence verification set, with the highest F1 score for evidence matching as the target. Subsequently, the evidence relationship is judged based on the subject, behavior, object, applicable conditions, numerical range, and negation polarity, constructing a conclusion-evidence relationship matrix M; matrix elements... =1 indicates a fragment of evidence. Supporting conclusions , =-1 means and contradiction, =0 indicates that the two are unrelated.
[0118] Step S63: Statistically calculate coverage, conflict degree, and proportion of unsubstantiated claims using the conclusion item set H and the conclusion-evidence relationship matrix M: This includes cases where at least one... The conclusion term with a value of 1 is considered to be supported by evidence, and there will be at least one such conclusion term. Conclusions with a value of -1 are considered conflicting, while conclusions with all rows of the corresponding matrix set to 0 are considered unfounded. A closed-loop score is calculated based on coverage, conflict level, and the proportion of unfounded conclusions. A closed-loop score threshold T is set. If the score is greater than or equal to T, the validation is considered successful, and the draft answer is used as the final answer, along with the supporting information for each conclusion, including the clause number, document identifier, and original text excerpt, as well as discrepancy warnings. The final question-and-answer result is then output. If the score is less than T, a tiered strategy of regenerating, supplementing context, and terminating output is employed. By modifying the original binary support matrix into a ternary matrix of support, conflict, and irrelevance, coverage, conflict level, and the proportion of unfounded conclusions are given corresponding matrix statistical basis.
[0119] The closed-loop score is calculated as follows: ;
[0120] Where A is the draft answer; S(A) is the closed-loop score of the draft answer A, S(A)∈[0,1]; This is the set of conclusions extracted from draft answer A. Let N = |H| be the i-th conclusion term, and let N = |H| be the total number of conclusion terms. A set of candidate evidence fragments in a highly credible context. Let K = |E| be the j-th piece of evidence, and M = [ [This is] an N×K dimensional conclusion-evidence relationship matrix. ∈{-1,0,1}, where the values represent evidence fragments. With conclusion Contradictory, irrelevant, or supportive; , and These are coverage, conflict rate, and proportion of unsubstantiated claims, all within the range [0,1]. , and The scoring weights are respectively for coverage, conflict-freeness, and evidence-basedness, satisfying... ≥0、 ≥0、 ≥0 and + + =1; in one example, =0.50、 =0.30、 =0.20.
[0121] The coverage = ,in, To satisfy "there exists at least one j such that..." =1” conclusion term The quantity; when N=0, let =0;
[0122] The degree of conflict = / N, where To satisfy "there exists at least one j such that..." =-1” conclusion term Quantity; =-1 is determined according to the relationship judgment result of subject, behavior or conclusion, object, applicable conditions, exception conditions, numerical range and negative polarity as described in step S62; when N=0, let =0;
[0123] The unfounded proportion = / N, where To satisfy "for all j, there is =0" conclusion term The quantity; when N=0, let =1.
[0124] The weights and closed-loop scoring threshold are determined through the labeled answer-evidence verification set: under the constraints that the weights are non-negative and the sum of the weights is 1, a grid search is performed on the weight combinations with a step size of 0.05, with the goal of maximizing the F1 value between the closed-loop verification passing result and the manually labeled result, and when the F1 values are the same, the combination with a larger coverage weight is preferentially selected; in an example, β1=0.50, β2=0.30, β3=0.20, and the closed-loop scoring threshold T=0.80. The optional range of T is [0.70, 0.90], which is calibrated on the verification set with a step size of 0.02.
[0125] When S(A)<T, hierarchical processing is executed: at the first level, the unsupported conclusion items, conflicting conclusion items and their evidence identifiers are written into generation constraints, requiring the model to delete unsupported statements, retain conflict descriptions and regenerate a draft answer, and then re-execute step S62 and step S63; at the second level, if the verification still fails after regeneration, the context is supplemented for the unsupported conclusion items, within the preset context length budget , fragments with the highest similarity to the conclusion item and high source credibility are supplemented from the semantic retrieval results, structured retrieval results and association graph expansion results; for conflicting conclusion items, fragments corresponding to higher-authority sources, updated valid versions and direct citation relationships are preferentially supplemented, followed by regeneration and scoring; at the third level, after the number of regeneration rounds reaches the upper limit =2, the closed-loop score is still less than T, or no new supporting evidence fragment is obtained after one consecutive context supplementation, or the context length reaches , the continuous generation is terminated, no substantive answer that fails the verification is output, but a prompt of "insufficient evidence" or "conflict exists" is output, and the failed conclusion items, retrieved sources and difference prompts are listed. is the context length budget determined in step S44, which is determined by compromising the average pass rate on the verification set and the computational overhead.
[0126] It should be noted that, in the above embodiments of the present application, the user query q, each fragment text in the high-credibility context set, consistency conclusions and difference prompt information are first assembled into a prompt template, a large language model is called to generate a natural language draft answer A, and a preliminary answer is generated based on high-quality context;
[0127] Then, key conclusion items are extracted from the draft answer to obtain a set H; for each conclusion item, candidate fragments in the high-credibility context are traversed to calculate the semantic similarity; when the similarity is not lower than the matching threshold, the corresponding fragment is taken as the evidence to be determined, and then the supporting, contradictory or irrelevant relationship is determined according to the subject, behavior, object, applicable condition, numerical interval and negative polarity, so as to construct a ternary conclusion-evidence relationship matrix M, thereby splitting the answer into verifiable conclusion items and establishing a clear evidence relationship for each item;
[0128] Finally, the conclusion item set H and the three-valued conclusion-evidence relationship matrix M are used to statistically analyze coverage, conflict degree, and proportion of unsubstantiated evidence, and a closed-loop score is calculated accordingly. If the score is greater than or equal to the threshold T, the final answer is output with references to the relevant clauses and a discrepancy notice. If the score is less than T, the system is first regenerated based on the constraints of the failed conclusion items, and then high-confidence fragments are added within the context budget and the score is re-evaluated. The process terminates when the upper limit of the regeneration rounds is reached, no new supporting evidence is obtained, or the context length budget is reached, and a notice indicating insufficient evidence or conflict and information on failed conclusion items are output, thus forming a complete closed loop that includes both successful output and failure exit.
[0129] Example 2 On the other hand, based on the knowledge question answering method based on hybrid retrieval enhancement provided in the invention embodiment one, this embodiment two also provides a knowledge question answering system based on hybrid retrieval enhancement, including a document modeling and index building module 10, a query parsing and retrieval routing module 20, a hybrid retrieval and clause corridor expansion module 30, a credibility assessment and propagation screening module 40, a conflict detection and consistency output module 50, and a result generation and answer-evidence closed-loop verification module 60.
[0130] Among them, the document modeling and index building module 10 is used to obtain the original documents of the knowledge base; after preprocessing the original documents, it obtains the semantic index and the structured index, as well as the correspondence between the semantic index and the structured index, through structured splitting and dual index building.
[0131] The query parsing and retrieval routing module 20 is used to receive and parse the user query q, and then solve and determine the semantic retrieval path weights based on the user query data of the user query q. Weight of structured retrieval pathway ;
[0132] User query data includes core semantic components. and set of clause elements The set of clause elements includes one or more of the following binding information: clause number, version number, effective date, scope of application, and responsible party;
[0133] Hybrid retrieval and terms corridor extension module 30, used to perform semantic retrieval path weighting Weight of structured retrieval pathway Determine the search type, and based on the search type and the structural matching terms, determine the set of candidate fragments;
[0134] The credibility assessment and propagation screening module 40 is used to assess the credibility of each candidate segment in the candidate segment set to obtain the initial credibility; construct a segment relationship graph based on the relationship between segments, perform credibility propagation iteration on the segment relationship graph to obtain the propagated credibility; and prune and sort the candidate segments according to the propagated credibility to obtain a high-credibility context set.
[0135] The conflict detection and consistency output module 50 is used to divide the high-confidence context set into multiple perspective groups according to the source type or version number, align the candidate conclusions corresponding to different perspective groups under the same problem dimension, and detect whether there is a conflict; if there is a conflict, the consistent conclusion is determined according to the preset priority rules, and difference prompt information is generated.
[0136] The answer-evidence closed-loop verification module 60 is used to generate a draft answer based on the user query q, a set of high-confidence contexts, and consistent conclusions; extract the conclusions from the draft answer and match evidence fragments for each conclusion item in the set of high-confidence contexts; calculate the closed-loop score; if the closed-loop score passes the preset threshold, the final question-and-answer result is output; if it fails, it is processed according to the hierarchical strategy of regenerating, supplementing context, and terminating output. When the termination condition is reached, a prompt indicating insufficient evidence or conflict is output.
[0137] In summary, the knowledge question answering method and system based on hybrid retrieval enhancement proposed in this invention performs structured decomposition of knowledge base documents, establishing semantic and structured indexes respectively, and establishing chapter adjacency relationships, version succession relationships, and explanatory citation relationships between fragments. After receiving user queries, it extracts core semantics and clause elements, and adaptively determines semantic retrieval, structured retrieval, or hybrid retrieval strategies. Based on the structurally matched clauses, it performs clause corridor expansion. It conducts credibility assessment, propagation, and screening based on fragment source, version validity, and matching degree. It performs conflict detection on candidate conclusions from different sources or versions, and outputs consistency conclusions and difference prompts in the order of validity, version, source, and credibility. Finally, it performs three-value relationship verification on the draft answer and cited evidence and calculates a closed-loop score. When the score passes, it outputs the final answer with clause basis. When the score fails, it regenerates and supplements the context in sequence. It terminates when the round limit is reached, no new evidence is added, or the context budget limit is reached, and outputs a prompt indicating insufficient evidence or conflict, thereby forming a complete closed loop that is traceable, verifiable, and can be safely exited.
[0138] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; those skilled in the art can modify the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A knowledge question answering method based on hybrid retrieval enhancement, characterized in that, The following steps are included: Obtain the original documents from the knowledge base; after preprocessing the original documents, perform structured splitting and dual-index construction to obtain the semantic index and the structured index, as well as the correspondence between the semantic index and the structured index; After receiving and parsing the user query q, the semantic retrieval path weights are determined based on the user query data of the user query q. Weight of structured retrieval pathway ; Based on semantic retrieval path weights Weight of structured retrieval pathway Determine the search type, and based on the search type and the structural matching terms, determine the set of candidate fragments; The credibility of each candidate segment in the candidate segment set is evaluated to obtain the initial credibility. A fragment relationship graph is constructed based on the relationships between fragments. Credibility propagation iteration is performed on the fragment relationship graph to obtain the propagated credibility. Based on the credibility after propagation, candidate fragments are pruned and sorted to obtain a set of highly credible contexts; The high-confidence context set is divided into multiple perspective groups according to source type or version number. Candidate conclusions corresponding to different perspective groups under the same problem dimension are aligned to detect whether there are conflicts. If a conflict exists, a consistent conclusion is determined based on the preset priority rules, and a difference prompt message is generated; A draft answer is generated based on the user query q, a set of highly reliable contexts, and consistent conclusions. Extract conclusions from the draft answers and match evidence fragments for each conclusion item in a set of high-confidence contexts; Calculate the closed-loop score. If the closed-loop score passes the preset threshold, output the final question and answer result. If it fails, it will be processed according to the hierarchical strategy of regenerating, supplementing the context and terminating the output. When the termination condition is met, a prompt indicating insufficient evidence or conflict will be output.
2. The knowledge question answering method based on hybrid retrieval enhancement according to claim 1, characterized in that, User query data includes core semantic components. and set of clause elements The set of clause elements includes one or more of the following constraint information: clause number, version number, effective date, scope of application, and responsible party.
3. The knowledge question answering method based on hybrid retrieval enhancement according to claim 2, characterized in that, After preprocessing the original document, structured splitting and dual-index construction are performed to obtain the semantic index and structured index, as well as the correspondence between the semantic index and the structured index. The process includes the following steps: The original documents in the knowledge base are preprocessed to obtain preprocessed documents. These preprocessed documents are then structurally split according to chapter, section, article, or paragraph boundaries to obtain multiple document fragments, and each document fragment is assigned a unique identifier. ; Construct semantic feature representations for each document fragment and build a semantic index; Build a structured index record for each document fragment; Based on unique identifier Establish a one-to-one correspondence between semantic indexes and structured indexes, and establish relationships between fragments.
4. The knowledge question answering method based on hybrid retrieval enhancement according to claim 3, characterized in that, A structured index must contain at least one or more of the following fields: document identifier, chapter, section, clause level, clause number, version number, publication date or effective date, scope of application, and source type; The relationships mentioned include at least one or more of the following: version succession, chapter adjacency, and description reference.
5. The knowledge question answering method based on hybrid retrieval enhancement according to claim 4, characterized in that, After receiving and parsing the user query q, the semantic retrieval path weights are determined based on the user query data of the user query q. Weight of structured retrieval pathway The operation includes the following steps: Receive user queries For user queries The core semantic part was obtained through parsing. and set of clause elements ; Calculate the core semantic parts respectively The semantic complexity index λ and the structural density index δ of the clause element set; The semantic retrieval path weights are determined based on the semantic complexity index λ and the structure density index δ of the clause element set. Weight of structured retrieval pathway .
6. The knowledge question answering method based on hybrid retrieval enhancement according to claim 5, characterized in that, Based on semantic retrieval path weights Weight of structured retrieval pathway Determine the search type, and based on the search type and the structural matching terms, determine the candidate fragment set, including the following steps: Weighting semantic retrieval pathways Weight of structured retrieval pathway Compare the threshold θ for the same preset search type; if If it is greater than or equal to θ, it is determined to be a semantic retrieval type; if If the value is greater than or equal to θ, it is determined to be a structured search type; if both are less than θ, it is determined to be a mixed search. When performing semantic retrieval or hybrid retrieval, based on the core semantic components Perform vector similarity retrieval on semantic feature representations to obtain a set of semantic candidate segments; When performing structured or hybrid search types, based on the set of clause elements. Construct structured search criteria, perform field matching search in the structured index, and obtain a set of candidate structure fragments; When performing a hybrid retrieval type, the semantic candidate fragment set and the structural candidate fragment set are merged and sorted to obtain a merged and sorted candidate fragment set; when performing a semantic retrieval type, the semantic candidate fragment set is directly used as the merged and sorted candidate fragment set; when performing a structured retrieval type, the structural candidate fragment set is directly used as the merged and sorted candidate fragment set. When the structure retrieval hits a clause fragment, the clause corridor expansion is performed with the hit clause fragment as the center. The expanded corridor candidate fragments are added to the candidate fragment set after fusion and sorting to obtain the candidate fragment set. The candidate fragments in the corridor are merged with the candidate fragment set after fusion and sorting, and deduplication is performed according to the unique identifier. The fragments are then sorted from high to low according to the corridor weighted score or fusion sorting score, and candidate fragments are retained within the preset context word capacity to obtain the candidate fragment set.
7. The knowledge question answering method based on hybrid retrieval enhancement according to claim 6, characterized in that, The credibility of each candidate segment in the candidate segment set is evaluated to obtain an initial credibility; a segment relationship graph is constructed based on the relationships between segments, and credibility propagation iterations are performed on the segment relationship graph to obtain the propagated credibility; the candidate segments are pruned and sorted according to the propagated credibility to obtain a high-credibility context set, including the following steps: For each candidate fragment in the candidate fragment set, calculate the initial confidence level based on its source type, version validity, and degree of matching with the query. ; Based on the relationships between fragments, nodes and their relationships are selected from the candidate fragment set to construct a candidate fragment relationship graph; and corresponding preset edge weights are set for various types of edges in the candidate fragment relationship graph according to the relationship type. Perform credibility propagation iteration on the candidate fragment relationship graph, let the credibility of each node at the 0th iteration be the initial credibility, and perform iterative update to obtain the target credibility of each node; Set a credibility pruning threshold τ and remove candidate segments whose target credibility is lower than the credibility pruning threshold τ; then sort the remaining candidate segments from high to low credibility after propagation, and retain candidate segments according to the preset upper limit of quantity and the available context word capacity to obtain a high credibility context set.
8. The knowledge question answering method based on hybrid retrieval enhancement according to claim 7, characterized in that, The high-confidence context set is divided into multiple perspective groups according to source type or version number. Candidate conclusions corresponding to different perspective groups under the same problem dimension are aligned to detect whether there are conflicts. If there are conflicts, a consistent conclusion is determined according to a preset priority rule, and a difference prompt message is generated. The operation steps include the following: Based on the source type or version number of each candidate fragment in the high-confidence context set, the candidate fragments are divided into different view groups; For each perspective group, candidate conclusions are extracted based on the question dimensions involved in the user query q. If there is no conflict, the conclusion of the perspective group with the highest credibility after dissemination shall be selected as the consistent conclusion. If a conflict exists, a consensus conclusion is determined in the following order: validity threshold, version priority, source priority, and credibility priority after dissemination, and a discrepancy prompt message is generated.
9. A knowledge question answering method based on hybrid retrieval enhancement according to claim 8, characterized in that, A draft answer is generated based on the user query q, a high-confidence context set, and consistent conclusions; conclusions are extracted from the draft answer, and evidence fragments are matched for each conclusion item in the high-confidence context set; a closed-loop score is calculated, and if the closed-loop score passes a preset threshold, the final question-and-answer result is output, including the following steps: The user query q, the text content of each candidate segment in the high-confidence context set, the consistency conclusion, and the difference prompt information are assembled into prompt words, and the large language model is called to generate a draft answer A in natural language; Extract key conclusion items from the draft answer to obtain a conclusion item set H; for each conclusion item, traverse candidate fragments in the high-confidence context set and calculate the semantic similarity between the conclusion item and the candidate fragment text; when the semantic similarity is not lower than the preset matching threshold, the corresponding candidate fragment is used as evidence to be judged, and a conclusion-evidence relationship matrix M is constructed based on the evidence to be judged. The closed-loop score is statistically calculated using the conclusion item set H and the conclusion-evidence relationship matrix M. Set a closed-loop scoring threshold T. If the closed-loop score is greater than or equal to T, the verification is considered successful. The draft answer is taken as the final answer, and the reference information of each conclusion item and the difference prompt information are attached. The final question and answer result is output.
10. A knowledge question answering system based on hybrid retrieval enhancement, characterized in that, It includes a document modeling and index building module, a query parsing and retrieval routing module, a hybrid retrieval and clause corridor expansion module, a credibility assessment and propagation screening module, a conflict detection and consistency output module, and a result generation and answer-evidence closed-loop verification module; The document modeling and index building module is used to obtain the original documents of the knowledge base. After preprocessing the original documents, it is processed by structured splitting and dual index building to obtain the semantic index and the structured index, as well as the correspondence between the semantic index and the structured index. The query parsing and retrieval routing module receives and parses the user query q, then uses the user query data based on q to solve for and determine the semantic retrieval path weights. Weight of structured retrieval pathway ; Hybrid retrieval and terms corridor extension modules are used to calculate semantic retrieval path weights. Weight of structured retrieval pathway Determine the search type, and based on the search type and the structural matching terms, determine the set of candidate fragments; The credibility assessment and propagation filtering module is used to assess the credibility of each candidate segment in the candidate segment set to obtain the initial credibility; construct a segment relationship graph based on the relationship between segments, perform credibility propagation iteration on the segment relationship graph to obtain the propagated credibility; and prune and sort the candidate segments according to the propagated credibility to obtain a high-credibility context set. The conflict detection and consistency output module is used to divide the high-confidence context set into multiple perspective groups according to source type or version number, align the candidate conclusions corresponding to different perspective groups under the same problem dimension, and detect whether there is a conflict; if there is a conflict, the consistent conclusion is determined according to the preset priority rules, and difference prompt information is generated. The Result Generation and Answer-Evidence Loop Validation module generates a draft answer based on the user query q, a high-confidence context set, and consistent conclusions. It then extracts conclusions from the draft answer and matches evidence fragments to each conclusion item in the high-confidence context set. A loop closure score is calculated; if the score passes a preset threshold, the final question-and-answer result is output. If it fails, a tiered strategy of regenerating, supplementing context, and terminating output is employed. Upon reaching the termination condition, a message indicating insufficient evidence or conflict is output.