A method and apparatus for enhancing question answering through dynamic field constraint propagation and multi-knowledge base hybrid retrieval

By generating a three-dimensional multi-knowledge base field capability tensor and constraint hierarchy, the problem of field constraints propagation in the knowledge base lifecycle is solved, and the consistency management of field constraints in multi-knowledge base hybrid retrieval is realized, which improves the credibility of the system in government affairs, community governance and enterprise system scenarios.

CN123115303APending Publication Date: 2026-11-17BEIJING GZT NETWORK TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610994884.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-06
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

In existing technologies, field constraints are disconnected from the knowledge base lifecycle, field semantics are inconsistent in multi-knowledge base retrieval, hybrid retrieval lacks consistency evaluation of field constraints, question-answering workflow lacks node-level evidence chains, and security checks and business retrieval lack unified constraint objects, resulting in reduced credibility of the system in government affairs, community governance, and enterprise system scenarios.

Method used

By generating a three-dimensional multi-knowledge base field capability tensor, performing constraint hierarchies, constructing an executable retrieval strategy, executing multi-way candidate recall, generating an answer evidence package, and inputting it into a large model to generate answer information, the full lifecycle management of field constraints is realized.

Benefits of technology

It enables continuous propagation and consistency management of field constraints in multi-knowledge base hybrid retrieval, supports full-process compliance auditing and effect traceability, and enhances the credibility of the system in government affairs, community governance and enterprise system scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123115303A_ABST
    Figure CN123115303A_ABST
Patent Text Reader

Abstract

This application discloses a dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering method and apparatus. The dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering method includes: acquiring user query information; generating a three-dimensional multi-knowledge base field capability tensor based on the user query information; performing constraint hierarchical classification on the three-dimensional multi-knowledge base field capability tensor to generate constraint hierarchy information; generating an executable retrieval strategy based on the multi-knowledge base field capability matrix and constraint hierarchy information; executing multi-way candidate recall based on the executable retrieval strategy to generate candidate answer fragments; constructing an answer evidence package based on the candidate answer fragments; and inputting the answer evidence package into a preset large model to generate answer information. This application can completely track the execution status of constraints at each node of multi-way recall, fusion ranking, and answer citation, realizing closed-loop management of the entire lifecycle of field constraints from query input to final output.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of automatic question answering technology, specifically to a method and apparatus for enhancing question answering through dynamic field constraint propagation and multi-knowledge base hybrid retrieval. Background Technology

[0002] With the development of large language models and enterprise knowledge base systems, retrieval enhancement and generation technologies have been widely applied in scenarios such as government services, community consultations, enterprise policy Q&A, technical document Q&A, and intelligent office assistants. Typical solutions usually include document parsing, text segmentation, vectorized storage, semantic retrieval, full-text retrieval, re-ranking, and large model answer generation. To improve retrieval accuracy, existing systems generally adopt a hybrid retrieval approach combining vector retrieval and keyword retrieval, and re-rank candidate fragments using a re-ranking model.

[0003] In enterprise-level knowledge management scenarios, knowledge fragments often contain not only natural language content but also structured attributes such as business affiliation, document category, publication status, permission scope, applicable region, time version, priority, and validity period. Existing vector databases and retrieval systems can already support metadata filtering to some extent, such as pre-filtering or post-filtering based on category, tag, or time fields. However, most common solutions treat metadata filtering as a one-time retrieval parameter rather than a continuous technical object that runs through knowledge base creation, data storage, retrieval recall, candidate fusion, prompt word construction, answer generation, and process auditing.

[0004] The existing technology has at least the following shortcomings:

[0005] First, field constraints are disconnected from the knowledge base lifecycle. Field types, names, valid values, default values, and filtering syntax defined during knowledge base creation are often only used at a single point during data entry or querying, lacking a cross-stage constraint propagation mechanism. Because field constraints are not continuously passed to the recall, fusion, answer citation, and auditing stages, the system struggles to explain why a particular answer uses a specific range of data, and it's difficult to track whether filtering conditions are consistently executed across multiple recall paths.

[0006] Second, there is inconsistency in field semantics during multi-knowledge-base retrieval. Multiple knowledge bases may have different custom field structures. For example, one knowledge base may use "category" to represent document categories, while another may use "doc_type"; one knowledge base may use an integer for "priority," while another may use a string for "priority." Traditional retrieval systems typically require the caller to manually construct filtering conditions for each knowledge base. This lack of a field capability matrix and field constraint compatibility checks for multiple knowledge bases can easily lead to problems such as incompatible filtering expressions, mismatched field types, or incorrect exclusion of some knowledge bases.

[0007] Third, hybrid retrieval fusion mainly relies on relevance scores and lacks consistency evaluation of field constraints. Existing vector retrieval, full-text retrieval, RRF fusion, and Reranking typically focus on the semantic relevance of text or the degree of keyword matching. When a candidate segment is semantically relevant but does not meet field constraints, such as inconsistent publication time, inconsistent region, unpublished status, or incorrect permission scope, traditional score fusion may still rank it at the top, leading to answers referencing non-compliant or outdated materials.

[0008] Fourth, the question-answering workflow lacks a node-level chain of evidence. While existing retrieval-enhanced question-answering systems can return cited fragments, they typically only indicate which texts were ultimately cited. They cannot fully explain how field constraints were generated, at which nodes they took effect, which candidates were filtered, what results were generated by different retrieval channels, how rearrangement and fusion affected the final citation, or whether the final answer is consistent with the field constraints. For scenarios requiring explainability and auditability, such as government affairs, community governance, and corporate policies, this issue reduces the system's credibility.

[0009] Fifth, there is a lack of unified constraint objects among security checks, business retrieval, fallback responses, and application dynamic routing. Many engineering systems implement security audits, knowledge base retrieval, HTTP interface calls, AI dialogues, and specified responses through workflow nodes. However, what is passed between nodes is mostly ordinary strings or lists of search results, lacking a unified structure that can carry field constraints, recall sources, filtering strategies, node status, and response evidence, making it difficult to perform accurate backtracking and automatic repair later. Summary of the Invention

[0010] The purpose of this invention is to provide a dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering method to at least solve one of the above-mentioned technical problems.

[0011] One aspect of the present invention provides a dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering method, the dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering method comprising:

[0012] Step 1: Obtain user query information;

[0013] Step 2: Generate a three-dimensional multi-knowledge base field capability tensor based on the user query information;

[0014] Step 3: Perform constraint hierarchies on the three-dimensional multi-knowledge base field capability tensor to generate constraint hierarchical information;

[0015] Step 4: Generate an executable retrieval strategy based on the multi-knowledge base field capability matrix and constraint hierarchy information;

[0016] Step 5: Perform multi-path candidate recall based on the executable retrieval strategy to generate candidate answer fragments;

[0017] Step 6: Construct an answer evidence package based on candidate answer fragments;

[0018] Step 7: Input the answer evidence package into the preset large model to generate answer information.

[0019] Optionally, obtaining user query information includes:

[0020] Step 11: Obtain explicit text layer information directly input by the user, including query subject semantic units, explicit qualifying fields, explicit logical predicates, and query task type;

[0021] Step 12: Generate implicit constraint layer information based on explicit text layer information, wherein the implicit constraint layer information includes domain ontology constraints, intent priority constraints, and semantic boundary constraints.

[0022] Step 13: In a multi-turn dialogue scenario, extract the session context layer information from the historical session interaction records. The session context layer information includes constraint inheritance fields, constraint modification fields, and session topic domain constraints.

[0023] Step 14: Parse the non-text modal data input by the user to extract modal auxiliary layer information, which includes attachment structured fields, cross-modal transcription fields, and front-end interaction constraint parameters;

[0024] Step 15: Perform semantic alignment, deduplication and fusion, and attribute annotation on the explicit text layer information, implicit constraint layer information, conversation context layer information, and modal auxiliary layer information to generate a set of constraint semantic units with attribute annotations;

[0025] Step 16: Extract the logical dependencies and constraints between the fields in the explicit text layer information, implicit constraint layer information, session context layer information, and modal auxiliary layer information to generate an initial semantic relationship set; the user query information includes the constraint semantic unit set and the initial semantic relationship set.

[0026] Optionally, step 2 includes:

[0027] Step 21: Extract the set of constraint semantic units and the set of initial semantic relations from the user query information. Construct a field constraint topology graph with constraint semantic units as vertices and logical dependencies and limiting relations in the set of initial semantic relations as weighted edges. Calculate the topological importance of each constraint semantic unit in the topology graph as the quantification value of the inherent constraint strength of the field.

[0028] Step 22: For each accessed heterogeneous knowledge base, retrieve the pre-built field capability profile. The field capability profile includes four capability dimension attributes: field accurate matching capability, semantic mapping capability, topology preservation capability, and relationship restoration capability, which correspond to single field value matching accuracy, single field semantic adaptability, constraint overall structure maintenance capability, and logical relationship restoration capability between fields, respectively.

[0029] Step 23: Perform semantic alignment mapping on each field in the constraint semantic unit set and the corresponding field capability profile of the heterogeneous knowledge base one by one, and perform weighted calculation based on the topological importance of the corresponding field to obtain the capability score of each query field in each dimension under the corresponding heterogeneous knowledge base.

[0030] Step 24: Construct a three-dimensional multi-knowledge base field capability tensor with constraint semantic units as the row dimension, each accessed heterogeneous knowledge base as the column dimension, and the four capability dimensions as the channel dimension.

[0031] Optionally, step 3 includes:

[0032] Step 31: Based on the topological structure of the field constraint topology graph and the topological importance of each constraint semantic unit, identify topological key points, ordinary connection nodes and dangling nodes, and divide the corresponding constraint semantic units into core constraint layer, support constraint layer and auxiliary constraint layer to obtain the field constraint hierarchy division result; wherein the topological key point is the node whose number of connected components in the topology graph increases after removal, and corresponds to the constraint semantic units of a preset proportion before the topological importance sorting.

[0033] Step 32: Based on the three-dimensional multi-knowledge base field capability tensor, fit the constraint strength-recall phase transition curve of each constraint level corresponding to each heterogeneous knowledge base, calculate the step critical point of each curve as the constraint tolerance threshold of the corresponding knowledge base, and determine the executable boundary of each heterogeneous knowledge base for different levels of constraints.

[0034] Step 33: Combining the field constraint hierarchy division results with the constraint tolerance thresholds of each heterogeneous knowledge base, configure cross-database unified constraint execution rules and single-database adapted fault tolerance thresholds for each constraint hierarchy; among which, the core constraint layer is configured with exact matching hard filtering rules, the support constraint layer is configured with semantic weighted matching rules, and the auxiliary constraint layer is configured with post-relevance verification rules.

[0035] Step 34: Integrate the field constraint hierarchy division results, the constraint tolerance thresholds of each knowledge base, and the constraint execution rules of each level to generate constraint classification information.

[0036] Optionally, step 4 includes:

[0037] Step 41: Extract the dimensional capability scores of each heterogeneous knowledge base from the three-dimensional multi-knowledge base field capability tensor, combine the field constraint level division results in the constraint grading information with the constraint tolerance threshold of each knowledge base, calculate the constraint propagation loss coefficient of each heterogeneous knowledge base under the core constraint layer, support constraint layer and auxiliary constraint layer, and determine the highest constraint execution level that each knowledge base can adapt to.

[0038] Step 42: Based on the constraint execution rules of each constraint level in the constraint hierarchy information, construct a dual-space retrieval architecture in which the semantic retrieval branch and the constraint retrieval branch are independent of each other; wherein the semantic retrieval branch is used to perform pure semantic similarity recall, and the constraint retrieval branch is used to perform constraint topology matching recall, and the two branches independently complete similarity calculation and initial ranking.

[0039] Step 43: Configure differentiated dual-space fusion rules and recall control parameters for the core constraint layer, supporting constraint layer, and auxiliary constraint layer respectively: the core constraint layer adopts a fusion rule of hard filtering of constraint branches followed by semantic branch reordering, the supporting constraint layer adopts a fusion rule of weighted calculation of dual-space scores, and the auxiliary constraint layer adopts a fusion rule of post-validation of constraint branches after semantic branch recall; at the same time, configure corresponding recall quantity and similarity threshold parameters for each constraint layer;

[0040] Step 44: Based on the constraint propagation loss coefficient of each knowledge base, a path optimization algorithm is used to select the multi-path recall path combination with the minimum constraint cumulative loss. This is combined with the fusion rules and recall control parameters of the corresponding constraint level to generate an executable retrieval strategy that includes recall paths, retrieval operators, sorting rules, and threshold parameters.

[0041] Optionally, step 5 includes:

[0042] Step 51: Based on the multi-path recall path, dual-space fusion rules and threshold parameters determined by the executable retrieval strategy, initiate the semantic retrieval branch and the constraint retrieval branch in parallel in each target heterogeneous knowledge base; the semantic retrieval branch performs dense recall based on pure semantic vector similarity to generate a set of semantic candidate fragments; the constraint retrieval branch performs structured recall based on constraint topology matching degree to generate a set of constraint candidate fragments.

[0043] Step 52: For the recall paths corresponding to the core constraint layer and the supporting constraint layer, calculate the topology drift amount after the field constraint topology is mapped across the knowledge base in real time; if the topology drift amount exceeds the preset compensation threshold, correct the retrieval vector of the constraint retrieval branch in the opposite direction of drift, perform supplementary recall after drift compensation, and update the constraint candidate fragment set.

[0044] Step 53: Perform cross-database deduplication and fragment granularity normalization on all semantic candidate fragment sets and constraint candidate fragment sets returned by the knowledge base, and label each candidate fragment with four attributes: constraint matching field set, topological matching degree, semantic matching degree, and source knowledge base identifier, to generate candidate answer fragments labeled with constraint attributes.

[0045] Optionally, step 6 includes:

[0046] Step 61: Using the field constraint topology graph as the skeleton structure, map each candidate answer fragment to the constraint topology space, filter fragments that cover the corresponding constraint level nodes and topological relationships, and combine them to generate multiple candidate evidence chains with matching topological structures.

[0047] Step 62: Identify candidate segments in different candidate evidence chains that have conflicting field values ​​or logical relationships, calculate the manifold alignment degree between each conflicting segment and the original field constraint topology graph, retain conflicting segments with manifold alignment degree higher than a preset threshold, and remove segments with low alignment degree to complete the conflict resolution of multi-source evidence.

[0048] Step 63: For the candidate evidence chains that have completed conflict resolution, perform a comprehensive scoring and ranking according to the three indicators of topological completeness, semantic coherence and source credibility, select the top-ranked preset number of evidence chains, and label each evidence chain with field matching degree, topological completeness and source credibility fidelity information.

[0049] Step 64: Integrate and encapsulate all the selected candidate evidence chains with their corresponding fidelity annotation information to generate a structured answer evidence package.

[0050] Optionally, step 7 includes:

[0051] Step 71: Extract each evidence chain and its corresponding fidelity labeling information from the answer evidence package, and transform the constraint topology corresponding to the evidence chain into a structured attention mask for the large model decoding layer; wherein a forced attention mask is set at the evidence token position corresponding to the core constraint layer, and a weighted attention mask is set at the evidence token position corresponding to the support constraint layer, which is used to limit the attention allocation range and weight in the large model decoding process;

[0052] Step 72: Extract the semantic features and constraint topology features of each evidence chain respectively, and map them to the hidden feature space of the preset large model through independent projection layers. Perform dual-space feature fusion at each step of decoding to simultaneously constrain the semantic fluency and constraint topology consistency of the generated content.

[0053] Step 73: In each step of the large model autoregressive generation, the values ​​of the constraint fields corresponding to the generated content are verified in real time; if a deviation is detected in the core constraint layer field, the process is reversed to the position of the last token that meets the constraint, the token sampling probability distribution of the current step is adjusted, and content that meets the constraint rules is forcibly generated, thus realizing a dynamic constraint closed loop in the generation process.

[0054] Step 74: After completing the full sequence decoding and generation, output the answer information that matches the hierarchical requirements of the constraint.

[0055] Optionally, step 21 includes:

[0056] Step 211: Using each constraint semantic unit in the constraint semantic unit set as a vertex, and the logical dependencies, constraints, subordination, and mutual exclusion relationships in the initial semantic relationship set as directed edges with attributes, construct the initial directed field constraint topology graph.

[0057] Step 212: Based on the logical relation types in the initial semantic relation set, assign corresponding edge weights to each directed edge, where the edge weights of limiting relations are greater than those of subordinate relations, and the edge weights of mutually exclusive relations are negative.

[0058] Step 213: Using the core semantic unit corresponding to the query task type as the personalized restart node, calculate the steady-state access probability of each vertex, and use the steady-state access probability as the topological importance of the corresponding constraint semantic unit;

[0059] Step 214: Normalize the topological importance of each constraint semantic unit to the [0,1] interval to obtain the quantized value of the inherent constraint strength of the field.

[0060] This application also provides a dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering device, the dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering device comprising:

[0061] User query information acquisition module, the user query information acquisition module is used to acquire user query information;

[0062] A three-dimensional multi-knowledge base field capability tensor acquisition module is used to generate a three-dimensional multi-knowledge base field capability tensor based on user query information.

[0063] The constraint grading information acquisition module is used to perform constraint grading on the three-dimensional multi-knowledge base field capability tensor, thereby generating constraint grading information.

[0064] An executable retrieval strategy acquisition module is used to generate an executable retrieval strategy based on a multi-knowledge base field capability matrix and constraint hierarchical information.

[0065] A candidate answer fragment acquisition module is used to perform multi-way candidate recall according to an executable retrieval strategy, thereby generating candidate answer fragments;

[0066] The answer evidence package acquisition module is used to construct an answer evidence package based on candidate answer fragments.

[0067] The response information acquisition module is used to input the response evidence package into a preset large model to generate response information.

[0068] This application transforms field constraints in user queries into a structured set of constraint semantic units and a field constraint topology graph. These serve as unified constraint objects throughout the entire process of query parsing, multi-database adaptation, retrieval recall, evidence fusion, and answer generation, changing the existing technology's approach of treating field constraints merely as single-point retrieval parameters. Constraint information is sequentially transmitted at each stage, allowing for complete tracking of the execution status of constraints at each node in multi-path recall, fusion sorting, and answer citation. This achieves closed-loop management of field constraints throughout their entire lifecycle from query input to final output, supporting full-process compliance auditing and effect traceability. Attached Figure Description

[0069] Figure 1 This is a flowchart illustrating a method for dynamic field constraint propagation and multi-knowledge base hybrid retrieval enhanced question answering according to an embodiment of this application;

[0070] Figure 2 This is a schematic diagram of the standardized constraint semantic unit structured data structure according to an embodiment of this application;

[0071] Figure 3 This is a schematic representation of a pre-assessment of the capabilities of heterogeneous knowledge base fields according to an embodiment of this application;

[0072] Figure 4 This is a schematic diagram of a hierarchical dual-space retrieval fusion sorting process according to an embodiment of this application;

[0073] Figure 5 This is a flowchart illustrating the traceable evidence chain of field constraints throughout the entire lifecycle, as described in one embodiment of this application. Detailed Implementation

[0074] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions in the embodiments of this application will be described in more detail below with reference to the accompanying drawings. In the drawings, the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The described embodiments are some, but not all, embodiments of this application. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application. The embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0075] like Figure 1 The dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering method shown includes:

[0076] Step 1: Obtain user query information;

[0077] Step 2: Generate a three-dimensional multi-knowledge base field capability tensor based on the user query information;

[0078] Step 3: Perform constraint hierarchies on the three-dimensional multi-knowledge base field capability tensor to generate constraint hierarchical information;

[0079] Step 4: Generate an executable retrieval strategy based on the multi-knowledge base field capability matrix and constraint hierarchy information;

[0080] Step 5: Perform multi-path candidate recall based on the executable retrieval strategy to generate candidate answer fragments;

[0081] Step 6: Construct an answer evidence package based on candidate answer fragments;

[0082] Step 7: Input the answer evidence package into the preset large model to generate answer information.

[0083] In this embodiment, step 1 is used to transform the multimodal, multi-source query information input by the user into a unified and standardized structured constraint semantic representation, serving as the standardized input basis for subsequent multi-knowledge base field capability matching, constraint hierarchical processing, and end-to-end constraint propagation. Step 1 includes the following steps:

[0084] Step 11: Obtain explicit text layer information directly input by the user. Specifically, collect directly observable text content such as natural language query text and structured query commands input by the user through the interactive interface; perform word segmentation, named entity recognition, semantic role labeling, logical relation extraction, and task type classification on the input text to extract four types of explicit semantic information:

[0085] Query subject semantic unit: The core entity, core concept and core demand object of the user query, which is the core semantic anchor point of the query;

[0086] Explicitly qualified fields: User-defined time intervals, geographical ranges, subject categories, numerical thresholds, document types, status attributes, and other limiting conditions;

[0087] Explicit logical predicates: Logical relationship identifiers between fields explicitly given by the user, such as "AND", "OR", "NOT", "greater than", "less than", "belongs to", and "exclude".

[0088] Query task types: Based on the request categories obtained from sentence structure and interrogative word recognition, including fact queries, comparison queries, calculation queries, process queries, attribution queries, etc.

[0089] The above four types of information together constitute explicit text layer information.

[0090] Step 12: Generate implicit constraint layer information based on explicit text layer information:

[0091] Specifically, using the explicit text layer information obtained in step 11 as input, and combining a pre-built domain ontology library, a pre-trained intent recognition model, and a semantic boundary reasoning engine, it automatically infers and generates default constraints that are not explicitly stated by the user but are necessarily true based on domain common sense and the query context. These constraints include three categories:

[0092] Domain ontology constraints: Based on the default attributes, legal value range, default statistical scope, and standard unit rules of the concepts in the corresponding domain ontology library, complete the default constraints that are not explicitly specified by the user. For example, in the government social security scenario, the default is limited to "basic social insurance for employees" and the default statistical scope is "on-the-job employees in the city".

[0093] Intent priority constraint: The degree of association between each semantic unit and the core query intent is calculated through the intent recognition model, and the priority weight ranking of all fields is generated to clarify the core constraint fields and secondary constraint fields;

[0094] Semantic boundary constraints: Based on the semantic category of the query subject, the semantic scope to be excluded by default is inferred. For example, when querying "corporate social security contribution ratio", the contribution rules of government agencies, public institutions and flexible employment personnel are excluded by default.

[0095] The above three types of constraints together constitute the implicit constraint layer information.

[0096] Step 13: In multi-turn dialogue scenarios, extract conversation context information from historical conversation interaction records.

[0097] The system examines the historical interaction records of the current session. If multiple rounds of dialogue context exist and the current query exhibits features such as ellipsis and conditional inheritance, then three types of contextual constraint information are extracted from the historical interactions:

[0098] Constraint inheritance fields: Conditions that have been explicitly confirmed by the user in the past dialogue and have not been denied in the current query are directly inherited as constraint fields of the current query;

[0099] Constraint Correction Fields: Field values ​​that users explicitly correct or replace in historical conversations will be based on the final corrected field values, overriding the original default values ​​and historical old values;

[0100] Conversation topic domain constraint: Based on the topic scope of the entire historical dialogue, the domain boundary is determined to limit the semantic scope and knowledge base retrieval scope of this query.

[0101] If it is a single-turn dialogue scenario with no historical interaction records, the session context layer information is an empty set.

[0102] Step 14: Parse the non-text modal data input by the user to extract the modal auxiliary layer information:

[0103] The system parses the non-text modal data and front-end interaction parameters input synchronously by the user, extracting the structured constraint information, specifically including three categories:

[0104] Attachment structured fields: Perform content parsing and entity extraction on user-uploaded attachment files such as tables, documents, and PDFs, extracting constraint information such as entity lists, numerical ranges, and attribute fields from the attachments;

[0105] Cross-modal transcription fields: Perform OCR text recognition, speech transcription, and keyframe content extraction on non-text data such as images, voice, and video uploaded by users, convert them into text, and then extract semantic units and limited fields.

[0106] Front-end interaction constraint parameters: Extract the filtering conditions selected by the user through components such as drop-down boxes, date pickers, numerical sliders, and filter buttons in the front-end interaction interface, such as "Publication time: within the last year" and "Document type: formal institutional document" selected on the page.

[0107] If the user does not perform any non-text modal input or front-end filtering operations, the modal auxiliary layer information is an empty set.

[0108] Step 15: Perform semantic alignment, deduplication and fusion, and attribute annotation on the four layers of information to generate a set of constrained semantic units with attribute annotations:

[0109] Perform uniform standardization processing on all field units in explicit text layer information, implicit constraint layer information, session context layer information, and modal auxiliary layer information:

[0110] First, semantic normalization alignment is performed to map fields with the same meaning but different names to a unified standard field naming system, eliminating naming differences;

[0111] Next, deduplication and conflict merging are performed. Multiple values ​​of the same field are validated and merged according to the priority rule of explicit input value > context correction value > modal extraction value > implicit inference default value. High priority values ​​are retained and low priority values ​​that are duplicated or conflicting are removed.

[0112] Subsequently, each field unit is labeled with an attribute tag, which includes four items: field source level, field data type (string / numeric / enumeration / time / boolean), field constraint type (main field / limited field / logical field), and priority weight.

[0113] Ultimately, all the processed field units together constitute a set of constraint semantic units with attribute annotations.

[0114] Step 16: Extract the logical dependencies and constraints between each field unit to generate an initial semantic relationship set, which together constitute the user query information:

[0115] Semantic relationships between field units are extracted from the raw information of the explicit text layer, implicit constraint layer, session context layer, and modal auxiliary layer. These relationships include five categories: limiting relationships, subordinate relationships, mutual exclusion relationships, dependency relationships, causal relationships, and numerical comparison relationships. Each semantic relationship is labeled with its relationship type, start and end field unit identifiers, and relationship strength coefficient. All extracted semantic relationships together constitute the initial semantic relationship set.

[0116] The set of constraint semantic units and the set of initial semantic relations together constitute structured user query information.

[0117] See Figure 2 Each constraint semantic unit in the aforementioned constraint semantic unit set is stored and transmitted throughout the entire process using a standardized structured data structure, as shown in Figure 2. This structure primarily includes ten attributes: a unique constraint identifier, a standardized field name, cross-database actual field mapping relationships, field data type, operator and value range, constraint level, applicable knowledge base scope, executable filtering expression, constraint generation reason, and a full-process execution snapshot. This structured object serves as a unified carrier of constraint information, continuously transmitted throughout the subsequent retrieval, fusion, and generation processes, and its status can be read, updated, and traced back at each stage.

[0118] In this embodiment, step 2 is used to transform the structured constraint representation output in step 1 into a field capability quantification result that can be compared horizontally across different knowledge bases. This step replaces the traditional discrete field set with a constraint topology structure, characterizing the adaptation and support capabilities of each heterogeneous knowledge base to field constraints from multiple dimensions, and finally constructing a three-dimensional multi-knowledge base field capability tensor, providing a unified quantitative decision-making basis for subsequent constraint classification and retrieval strategy generation. Step 2 includes the following steps:

[0119] The cross-database field capability assessment process in this step is as follows: Figure 3 As shown, the system reads the original field schema of each heterogeneous knowledge base one by one, and judges the name mapping relationship, type compatibility, filtering capability, output capability and structural support capability of each field based on the unified standard field. For fields with different names but consistent semantics, a mapping relationship is established, and for fields with incompatible types, propagation restrictions are marked. Finally, the system outputs the multi-dimensional capability evaluation results of each field under the corresponding knowledge base, providing basic data for the construction of three-dimensional tensors.

[0120] Step 21: Extract the set of constraint semantic units and the set of initial semantic relations from the user query information. Construct a field constraint topology graph with constraint semantic units as vertices and logical dependencies and limiting relations in the initial semantic relation set as weighted edges. Calculate the topological importance of each constraint semantic unit in the topology graph, which serves as the quantification value of the inherent constraint strength of the field.

[0121] The input for this step is the set of constraint semantic units and the initial set of semantic relations output from step 1. Through topological modeling and constraint diffusion calculation, the global constraint strength of each constraint field is quantified. This invention employs a constraint strength topological diffusion iterative method, simultaneously considering the forward propagation attenuation of constraint relations and the reverse inhibition characteristics of mutually exclusive relations, thus conforming to the actual propagation law of field constraints. The specific process is as follows:

[0122] First, each constraint semantic unit in the constraint semantic unit set is used as a vertex, and a unique identifier is assigned to each vertex. The four types of semantic relations in the initial semantic relation set—limited, subordinate, dependent, and mutually exclusive—are used as directed edges with attributes. The direction of the edges is determined by the logical direction of the relation: the limit relation, subordinate relation, and dependent relation are forward propagation edges, and the direction is from the constrained field to the constraint field (i.e. from the core subject semantic unit to each limiting condition field), ensuring that the constraint strength can spread outward from the core source point.

[0123] Mutual exclusion is represented by negative suppression edges, with a bidirectional direction. This constructs the initial directed field-constrained topology graph. , where V is the set of vertices, E is the set of directed edges, and W is the edge weight matrix.

[0124] Secondly, each directed edge is assigned a corresponding edge weight based on the type of semantic relation: in the forward propagation edges, the edge weight for limiting relations (including numerical comparison relations) ranges from 0.6 to 1.0, the edge weight for dependency relations ranges from 0.4 to 0.8, and the edge weight for subordinate relations ranges from 0.3 to 0.6; the edge weight for negative suppression edges (mutual exclusion relations) is negative, ranging from -1.0 to -0.5; the higher the relation strength, the larger the absolute value of the corresponding edge weight.

[0125] Subsequently, the core subject semantic unit corresponding to the query task is identified from the constraint semantic units, and it is used as the initial source node for constraint diffusion. The steady-state constraint strength of each vertex is calculated using the constraint strength topology diffusion iterative formula, as follows:

[0126] ;

[0127] in, For the t-th iteration, the th iteration... The constraint strength value of each vertex; The constraint diffusion attenuation coefficient has a value range of 0.7 to 0.9. In this embodiment, it is set to 0.85, which is used to control the attenuation degree of the constraint propagating along the topology. Let i be the set of all adjacent vertices of vertex i; Let be the edge weight from vertex j to vertex i, with positive values ​​for positive edges and negative values ​​for negative edges; The initial constraint source vector is defined as follows: the vertex corresponding to the core semantic unit has a value of 1, and the other vertices have a value of 0. This vector is used to anchor the initial source of constraint diffusion.

[0128] The iterative formula in this application is based on the idea of ​​random walk with personalized restart, and supports the propagation decay of positive constraints and the reverse suppression of mutual exclusion relationships: taking the core subject semantic unit as the restart source point, positive weight edges corresponding to positive relationships such as limitation and subordination realize the positive propagation of constraint strength, and negative weight edges corresponding to mutual exclusion relationships realize the reverse suppression of constraint strength. After iterative convergence, the topological importance of the global steady state is obtained.

[0129] This application incorporates the constraint topology with positive and negative edges into the field constraint strength calculation. Through the topology diffusion mechanism, the global steady-state constraint strength of each field is obtained, which accurately reflects its actual role level in the overall constraint system and provides a unified quantitative benchmark for subsequent constraint classification, cross-database capability matching, and loss calculation.

[0130] The convergence condition for the iteration is set as follows: the norm of the change in constraint strength of all vertices in two consecutive iterations is less than 1. ,Right now The iteration stops after the convergence condition is met, and the converged intensity vector is obtained. The values ​​of each vertex are the original values ​​of the topological importance of the corresponding constraint semantic unit.

[0131] Finally, the original values ​​of topological importance of all constraint semantic units are subjected to min-max normalization to map them to the [0,1] interval, resulting in the quantized value of the intrinsic constraint strength of each field. The calculation formula is as follows:

[0132] ;

[0133] in, This is the quantized value of the inherent constraint strength of the i-th constraint semantic unit; This represents the original value of the topological importance of the i-th vertex; , These are the minimum and maximum values ​​of the original topological importance of all vertices, respectively. The quantized values ​​of the inherent constraint strength are used for the weighted calculation of subsequent capability scores.

[0134] In this embodiment, the initial values ​​for iteration are set as follows: during the 0th iteration, the initial constraint strength of all vertices is consistent with the initial constraint source vector, i.e. The initial value of the vertex corresponding to the core semantic unit is 1, and the initial value of the other vertices is 0.

[0135] The constraint strength topology diffusion iteration method used in this step is essentially a random walk algorithm with personalized restarts. The steady-state constraint strength value after iterative convergence is the steady-state access probability of the vertex.

[0136] Step 22: For each accessed heterogeneous knowledge base, retrieve the pre-built field capability profile. The field capability profile includes four capability dimension attributes: field accurate matching capability, semantic mapping capability, topology preservation capability, and relationship restoration capability, which correspond to single field value matching accuracy, single field semantic adaptability, constraint overall structure maintenance capability, and logical relationship restoration capability between fields, respectively.

[0137] In this embodiment, step 22 retrieves the pre-built offline field capability profiles for each heterogeneous knowledge base of the access system. The field capability profile is a structured capability description file based on the knowledge base's field metadata, index structure, field retrieval accuracy, and historical mapping effect statistics. It characterizes the knowledge base's support capabilities for various field constraints and includes four capability dimension attributes. Each dimension has a value range of [0,1], with higher values ​​indicating stronger corresponding capabilities.

[0138] Field exact matching capability: This represents the knowledge base's ability to perform exact matching and retrieval of field values. The accuracy and recall level of single field value matching depend on whether the field has an exact index, whether it supports equality filtering, and whether the field value is standardized.

[0139] Specifically, the field exact matching capability represents the knowledge base's ability to support exact matching retrieval of field values. It corresponds to the precision and recall level of single-field value matching, and is calculated by a weighted average of three factors: index completeness factor, field structuring factor, and value standardization factor. The calculation formula is as follows:

[0140] ;

[0141] in, The score for the exact match capability of the k-th field;

[0142] , , For the weighting coefficients, satisfying + + =1, and in this embodiment, the values ​​are 0.4, 0.3, and 0.3 respectively;

[0143] Index completeness factor: 1.0 if the field has an exact inverted index and supports equality filtering, and 0.2 if it only supports full table scan matching;

[0144] The field structuring factor is set as follows: 1.0 for enumerated fields, 0.8 for numeric fields, 0.5 for short string fields, and 0.2 for long text unstructured fields.

[0145] Standardization factor: The calculation formula is the number of standardized values ​​ / the total number of field values. Standardized values ​​refer to field values ​​that conform to domain standard coding, have no dirty data, and have a uniform format.

[0146] Semantic mapping capability: Represents the semantic adaptation capability of the knowledge base to non-synonymous fields. The semantic adaptation degree of a single field depends on the completeness of the knowledge base's field semantic system, the coverage of the thesaurus, and the semantic retrieval support capability.

[0147] Specifically, semantic mapping capability represents the knowledge base's semantic adaptability to non-synonymous fields. The semantic adaptability of a single field is calculated by weighting three factors: semantic index support factor, semantic recognizability factor, and synonym coverage factor. The calculation formula is as follows:

[0148] ;

[0149] , , For the weighting coefficients, satisfying + + =1, and in this embodiment, the values ​​are 0.4, 0.3, and 0.3 respectively;

[0150] Semantic indexing support factor: If the content corresponding to this field has been indexed by a vector and supports semantic similarity retrieval, then the value is 1.0; otherwise, it is 0.3.

[0151] For semantically identifiable factors: 1.0 for business attribute fields (such as document category, region, and publication status), and 0.1 for identifier fields without business semantics (such as serial number and primary key ID).

[0152] The synonym coverage factor is calculated as the number of domain synonyms that have been matched for this field / the total number of standard domain synonyms. The default value is 0.2 when no domain synonym dictionary is configured.

[0153] Topology preservation capability: Characterizes the knowledge base's ability to maintain the overall structure of multi-field combined constraints, corresponding to the fidelity level of the overall constraint structure, which depends on whether the knowledge base supports multi-field joint retrieval and the ability to maintain the structural consistency of joint retrieval;

[0154] Specifically, topology preservation capability characterizes the knowledge base's ability to maintain the overall structure of multi-field combined constraints, corresponding to the fidelity level of the overall constraint structure. It is calculated by weighting three factors: joint retrieval support factor, recall decay factor, and joint index coverage factor. The calculation formula is as follows:

[0155] ;

[0156] in, The topology preservation score for the k-th field; , , For the weighting coefficients, satisfying + + =1, and in this embodiment, the values ​​are 0.3, 0.4, and 0.3 respectively;

[0157] For joint retrieval support factor: if this field supports joint filtering retrieval with any other field, the value is 1.0; if it only supports retrieval with a fixed field, the value is 0.5; if it does not support joint retrieval with multiple fields, the value is 0.1.

[0158] The recall decay factor is calculated using the following formula: ,in The average recall rate for single-field retrieval. The average recall rate is the result of simultaneously overlaying constraints from three related fields. The smaller the decay, the higher the score. The value range is limited to [0,1].

[0159] For composite index coverage factor: 1.0 if the field is included in at least 2 multi-field composite indexes, 0.6 if included in only 1 composite index, and 0.2 if there is no composite index coverage.

[0160] Relationship reconstruction capability: This represents the knowledge base's ability to identify and reconstruct logical relationships between fields. The accuracy of matching logical relationships between fields depends on whether the knowledge base supports structured relationship retrieval and the accuracy of relationship extraction.

[0161] Specifically, relation reconstruction capability represents the knowledge base's ability to identify and reconstruct logical relationships between fields, corresponding to the matching accuracy of logical relationships between fields. It is calculated by weighting three factors: relation storage factor, relation extraction accuracy factor, and relation retrieval support factor. The calculation formula is as follows:

[0162] ;

[0163] in, The relational reconstruction capability score for the k-th field; , , For the weighting coefficients, satisfying + + =1, and in this embodiment, the values ​​are taken as 0.35, 0.4, and 0.25 respectively;

[0164] The relational storage factor is 1.0 if the knowledge base explicitly stores the ontology association and foreign key mapping relationship between this field and other fields, and 0.3 if the field relationship is only implicit in the natural language text.

[0165] Accuracy factor for relation extraction: Take the average accuracy of extracting logical relations between fields from the document fragments to which the field belongs in the historical test set. The value range is [0,1]. The default value is 0.5 when there is no historical test data.

[0166] The factor for relational retrieval support is 1.0 if chained retrieval based on field relational paths is supported, and 0.2 if only single-field independent filtering is supported.

[0167] The four-dimensional scores of all the above fields can be pre-calculated. After calculation, they are encapsulated into structured field capability profile files according to the knowledge base dimensions. When querying online, the field capability profiles of the corresponding heterogeneous knowledge bases can be directly retrieved without real-time calculation, ensuring retrieval response efficiency.

[0168] In this embodiment, step 23: Semantic alignment mapping is performed on each field in the constraint semantic unit set and the field capability profile of the corresponding heterogeneous knowledge base one by one, and weighted calculation is performed in combination with the topological importance of the corresponding field to obtain the capability score of each query field in each dimension under the corresponding heterogeneous knowledge base.

[0169] This step takes the set of constraint semantic units, the inherent constraint strength of the field, and the capability profiles of fields in each heterogeneous knowledge base as input to complete the semantic alignment between the query field and the knowledge base fields. This application adopts a topological neighborhood-aware cross-database field capability scoring formula, introducing first-order neighborhood topological overlap as a correction factor. It couples the single-field matching capability with the topological structure preservation capability in the calculation, ensuring that the score simultaneously reflects both the individual field matching degree and the overall adaptability of the constraint structure. The specific process is as follows:

[0170] For each constraint semantic unit i, semantic alignment matching is performed sequentially with the full field set of each heterogeneous knowledge base j: a pre-trained semantic encoding model is used to encode the text vectors of the constraint semantic unit and the knowledge base fields respectively, and the semantic basic similarity between the two is calculated; at the same time, the set of first-order adjacent vertices of constraint semantic unit i in the field constraint topology graph is extracted. The proportion of matching fields in the corresponding knowledge base of the adjacency set is counted to obtain the neighborhood topological overlap.

[0171] The formula for calculating semantic basic similarity is:

[0172] ;

[0173] in, Let i be the semantic basis similarity between the i-th constraint semantic unit and the k-th field in the j-th heterogeneous knowledge base; The semantic encoding vector for constraining semantic units; This is the semantic encoding vector for the knowledge base field.

[0174] The formula for calculating the topological overlap of a neighborhood is:

[0175] ;

[0176] in, To constrain the topological overlap of semantic unit i in knowledge base j; For knowledge base j, there is a set of all fields. The semantic alignment threshold is set to 0.7 in this embodiment; This represents the number of elements in the set. This metric reflects the degree to which the surrounding topology of the constraint field can be restored in the target knowledge base.

[0177] The knowledge base field with the highest semantic similarity and greater than or equal to the alignment threshold is selected as the matching target field. Combining the field's inherent constraint strength, neighborhood topological overlap, and the four-dimensional raw score of the field's capability profile, the final weighted capability score is calculated using the following formula:

[0178] ;

[0179] in, The weighted capability score for the i-th constraint semantic unit in the d-th capability dimension under the j-th heterogeneous knowledge base; This is the quantization value of the inherent constraint strength of the constraint semantic unit; This represents the original capability score of the k-th matching field in the j-th knowledge base in the d-th capability dimension. is the dimension adjustment coefficient, used to control the influence weight of topological overlap on different dimensions: 1.0 for exact matching capability (not affected by neighborhood), 0.8 for semantic mapping capability, 0.3 for topology preservation capability, and 0.2 for relation restoration capability; d is the capability dimension index, with values ​​from 1 to 4 corresponding to the field exact matching capability, semantic mapping capability, topology preservation capability, and relation restoration capability, respectively.

[0180] This application incorporates the reproducibility of neighborhood topology into the cross-database field capability evaluation system, breaking the limitations of traditional single-field isolated scoring. This makes the capability score more closely match the actual retrieval effect under multiple constraint combinations, solving the problem that traditional single-field matching generally overestimates the cross-database constraint support capability. This is the core computational logic of the three-dimensional field capability tensor.

[0181] If no matching field meets the alignment threshold, the capability score of the constraint semantic unit in each dimension of the corresponding knowledge base is recorded as 0. Traverse all constraint semantic units and all heterogeneous knowledge bases to complete the dimensional capability score calculation for all fields.

[0182] In this embodiment, step 24: construct a three-dimensional multi-knowledge base field capability tensor with constraint semantic units as the row dimension, each accessed heterogeneous knowledge base as the column dimension, and four capability dimensions as the channel dimension.

[0183] Step 24, based on the full-scale multi-dimensional ability scores obtained in Step 23, constructs a three-dimensional multi-knowledge base field ability tensor with a third-order tensor structure. The three dimensions of the tensor are defined as follows:

[0184] Row dimension: corresponds to all constraint semantic units. The dimension length is equal to the number of elements in the constraint semantic unit set. Each row index corresponds to a unique constraint semantic unit.

[0185] Column dimension: corresponds to all accessed heterogeneous knowledge bases. The dimension length is equal to the total number of heterogeneous knowledge bases accessed by the system. Each column index corresponds to a unique heterogeneous knowledge base.

[0186] Channel Dimensions: These correspond to four field capability dimensions, with a fixed length of 4. In order, they are: field precise matching capability, semantic mapping capability, topology preservation capability, and relationship restoration capability.

[0187] The three-dimensional multi-knowledge base field capability tensor is denoted as Where N is the total number of constraint semantic units, and M is the total number of heterogeneous knowledge bases; elements at any position in the tensor satisfy:

[0188] ;

[0189] in, The row dimension index corresponds to the i-th constraint semantic unit; This is a column-dimensional index, corresponding to the j-th heterogeneous knowledge base; This is a channel dimension index, corresponding to the d-th field, the capability dimension.

[0190] In this embodiment, step 3 includes:

[0191] Step 31: Based on the topological structure of the field constraint topology graph and the topological importance of each constraint semantic unit, identify topological key points, ordinary connection nodes and dangling nodes, and divide the corresponding constraint semantic units into core constraint layer, support constraint layer and auxiliary constraint layer to obtain the field constraint hierarchy division result; wherein the topological key point is the node whose number of connected components in the topology graph increases after removal, and corresponds to the constraint semantic units of a preset proportion before the topological importance sorting.

[0192] In this embodiment, step 31 divides all constraint semantic units into three levels—core constraint layer, supporting constraint layer, and auxiliary constraint layer—through topological key point identification, node type classification, and importance ranking. The specific process is as follows:

[0193] The first step is to calculate the articulation coefficient for each vertex to identify topological articulation points. Topological articulation points are key nodes whose removal would significantly increase the number of connected components in the topological graph; they are the core supporting nodes that constrain the topological structure. The formula for calculating the articulation coefficient is:

[0194] ;

[0195] in, The keypoint coefficients of the vertex corresponding to the i-th constraint semantic unit, with values ​​ranging from [0,1]. The original field constrains the total number of connected components in the topology graph; This represents the increment in the number of connected components in the topological graph after removing the i-th vertex.

[0196] If the key point coefficient If the threshold is ≥1, the vertex is determined to be a topological key. In small-scale topological scenarios with fewer than 5 constraint nodes, the threshold is increased to 0.5 to identify only nodes that have a decisive impact on overall connectivity. In medium-to-large-scale topological scenarios with 10 or more constraint nodes, the threshold is set to 0.1 to identify nodes that significantly affect local connectivity. This embodiment is designed for enterprise-level multi-field query scenarios, where the number of constraint nodes is typically 10-30; therefore, a threshold of 0.1 is used.

[0197] The second step is to distinguish between dangling nodes and regular connected nodes:

[0198] In this step, based on the directed field constraint topology graph constructed in step 21, the degree parameter of each vertex is first explicitly defined: For any vertex in the topology graph (corresponding to a constraint semantic unit), the in-degree refers to the total number of directed edges terminating at that vertex, which is used to characterize the number of associations where the constraint field is subject to positive constraints such as limitation, subordination, and dependency from other constraint fields, as well as the number of associations subject to mutual exclusion and inhibition from other constraint fields; the out-degree refers to the total number of directed edges starting at that vertex, which is used to characterize the number of associations where the constraint field exerts positive constraints such as limitation, subordination, and dependency on other constraint fields, as well as the number of associations subject to mutual exclusion and inhibition from other constraint fields; the in-degree value and the out-degree value of the same vertex are added together to obtain the total degree of that vertex, which is used to characterize the overall degree of association of the constraint field in the entire constraint topology.

[0199] Then, the node type is determined:

[0200] If the total degree of a vertex is equal to 1 and the vertex is not identified as a topological joint, then the vertex is identified as a dangling node. A dangling node has only one unidirectional association with another constraint field in the constrained topology, is located at the edge of the constrained topology, and has the weakest supporting effect on the overall constrained structure. Its absence will not cause the connection structure of the constrained topology to change.

[0201] If a vertex is neither a topological key nor a dangling node, it is classified as a regular connection node. Regular connection nodes are associated with two or more other constraint fields in the constrained topology, and play a role in local connection and constraint transmission in the constrained topology. They are the transition support between core constraints and edge constraints. Their absence will cause the local constraint association to break, but will not cause a significant increase in the overall connected components of the topology graph.

[0202] The third step is to complete the constraint hierarchy mapping by combining the topological importance ranking:

[0203] First, all constraint semantic units are sorted from high to low according to their inherent constraint strength quantization values. Combining the aforementioned node type determination results and sorting positions, all constraint semantic units are divided into three levels: core constraint layer, supporting constraint layer, and auxiliary constraint layer. The specific division rules are as follows:

[0204] Core constraint layer: Includes all constraint semantic units identified as topological nodes, as well as non-node constraint semantic units whose inherent constraint strength quantification values ​​rank in the top 20%. The fields at this level are the core limiting conditions for the query, and their values ​​directly determine the compliance and semantic accuracy of the query results. If the fields at this level are missing or their values ​​deviate, the query results will deviate fundamentally from the user's core needs.

[0205] Support constraint layer: Includes all constraint semantic units that are judged as ordinary connection nodes and have not entered the core constraint layer, as well as constraint semantic units whose inherent constraint strength quantification value is ranked in the top 20% to top 70% range and have not entered the core constraint layer; the fields at this level are used to help limit the query range and refine the result precision. They do not have a decisive impact on the core semantics of the query, but they will significantly affect the matching quality and accuracy of the query results.

[0206] Auxiliary constraint layer: Includes all constraint semantic units that are determined to be dangling nodes, as well as constraint semantic units whose inherent constraint strength quantification value is in the bottom 30% and has not entered the first two levels; the fields in this level are supplementary and optimization constraints, mainly used to improve the relevance ranking effect of search results, and do not require all search results to match, and their absence will not affect the core compliance of the query results.

[0207] Step 32: Based on the three-dimensional multi-knowledge base field capability tensor, fit the constraint strength-recall phase transition curve of each constraint level corresponding to each heterogeneous knowledge base, calculate the step critical point of each curve as the constraint tolerance threshold of the corresponding knowledge base, and determine the executable boundary of each heterogeneous knowledge base for different levels of constraints.

[0208] This step quantifies the upper limit of each heterogeneous knowledge base's capacity to withstand constraints at different levels. It extracts constraint tolerance thresholds through theoretical estimation and curve fitting, clarifying the executable boundaries of each knowledge base at its corresponding constraint level. This provides a quantitative decision-making basis for subsequent configuration of differentiated constraint execution rules. Specifically, it includes:

[0209] Step 321: Constraint Strength Gradient Sampling and Constraint Subset Construction. For the j-th heterogeneous knowledge base and the L-th constraint level (L corresponds to the core constraint layer, supporting constraint layer, and auxiliary constraint layer, respectively), firstly, extract all constraint semantic units contained in that level from the field constraint level division results. Sort these units according to their inherent constraint strength quantization values ​​from high to low to obtain an ordered unit sequence. Then, sequentially select the first n units from the sequence to form the n-th constraint subset, where n ranges from 1 to the total number of constraint semantic units in that level. For the nth constraint subset, its corresponding cumulative constraint strength The sum of the intrinsic constraint strength quantization values ​​of all constraint semantic units in this subset is calculated using the following formula:

[0210] ;

[0211] in, This is the quantization value of the inherent constraint strength of the i-th constraint semantic unit, with a value range of [0,1].

[0212] Therefore, we obtain A constraint subset with increasing constraint strength is formed into a constraint strength gradient sampling sequence, which is used for subsequent point-by-point prediction of the corresponding recall rate.

[0213] Step 322: Calculation of the estimated recall rate for a single constrained subset

[0214] For each constraint subset, based on the dimensional capability scores of the corresponding knowledge base in the three-dimensional multi-knowledge base field capability tensor, the theoretical estimated recall rate of knowledge base j under that constraint subset is calculated. The calculation combines the execution characteristics of the constraint hierarchy with weight matching: the core constraint layer prioritizes precise matching capabilities, while the supporting and auxiliary constraint layers gradually increase their semantic mapping capabilities. The specific calculation formula is as follows:

[0215] ;

[0216] in, The score is given to the field accuracy matching ability of the i-th constraint semantic unit in the j-th heterogeneous knowledge base, and the value range is [0,1]. The semantic mapping capability of the i-th constraint semantic unit in the j-th heterogeneous knowledge base is scored, with the value range being [0,1]. This is the exact matching weight coefficient for the Lth constraint level, used to adjust the ratio of exact matching to semantic matching; in this embodiment, it represents the core constraint layer. Take 0.8, support constraint layer Set to 0.5, auxiliary constraint layer The value is 0.2; the product operation represents the joint decay effect of recall after the superposition of multiple field constraints. The more constraint fields there are, the lower the overall recall rate, which is consistent with the general decay law of retrieval systems.

[0217] By iterating through all n values, we obtain the sequence of discrete points of the estimated recall rate that correspond one-to-one with the constraint strength gradient at this level for the knowledge base.

[0218] Step 323: Fitting the Constraint Strength-Recall Phase Transition Curve

[0219] With cumulative constraint strength The x-axis represents the corresponding estimated recall rate. Using the ordinate, we obtain There are discrete sampling points. The inverse descent form of the Logistic function is used to fit these discrete points, resulting in a continuous constraint strength-recall phase transition curve. The fitting function expression is:

[0220] ;

[0221] in, This represents the estimated recall rate when the constraint strength is S. This is the upper limit of recall rate, i.e., the baseline recall rate without additional constraints, which is normalized to 1.0 in this embodiment; is the lower limit of recall, that is, the lowest recall rate when the constraint strength reaches saturation, and its value is 0; k is the phase transition steepness coefficient, which characterizes the rate at which the recall rate decreases as the constraint strength increases. The larger the value, the more obvious the step. This represents the phase transition center location, i.e., the constraint strength corresponding to when the recall rate drops to its maximum value of 50%.

[0222] The discrete sampling points are fitted using the nonlinear least squares method to determine k and the relationship between k and k in the above fitting function. The parameters are used to obtain a continuous and smooth phase transition curve. The curve generally exhibits an S-shaped decreasing characteristic: when the constraint strength is low, the recall rate remains at a high level and decreases slowly; when the constraint strength approaches the critical range, the recall rate experiences a rapid step-down; after the constraint strength exceeds the critical range, the recall rate tends to level off and approach the lower limit.

[0223] Step 324: Extraction of step critical point and determination of constraint tolerance threshold:

[0224] The phase transition curve function obtained by fitting The point where the absolute value of the second derivative is largest is the critical point of the curve's step change. This point corresponds to the abrupt change in constraint strength and represents the knowledge base's capacity to withstand constraints at that level. The specific calculation process is as follows:

[0225] Solve the fitting function first derivative This characterizes the rate at which recall decreases with increasing constraint strength;

[0226] The derivative of the first derivative is the second derivative. , representing the rate of change of the rate of descent;

[0227] Let the absolute value of the second derivative be maximized, i.e., | The constraint strength value corresponding to the maximum value is the step critical point of the phase transition curve.

[0228] The constraint strength value corresponding to the step critical point is determined as the constraint tolerance threshold of the j-th heterogeneous knowledge base at the L-th constraint level. .

[0229] When the applied constraint strength is lower than When the knowledge base maintains a high recall level, the constraint enforcement effect is stable; when the constraint strength is higher than When the recall rate drops precipitously, the knowledge base will be unable to effectively support the execution of constraints at that level. Therefore, this threshold is the executable boundary of the knowledge base for the corresponding level of constraints.

[0230] Step 325: Boundary Scene Processing and Threshold Matrix Generation

[0231] For boundary scenarios where the number of constraint units is too small to fit an effective phase transition curve, a proportional threshold method is used as a fallback: the constraint strength value corresponding to the estimated recall dropping to 70% of the baseline recall is taken as the constraint tolerance threshold; if the recall is still higher than 70% after all constraints are superimposed, the total constraint strength of that level is used as the tolerance threshold. After traversing all accessed heterogeneous knowledge bases and all three constraint levels to complete the calculation of all constraint tolerance thresholds, a constraint tolerance threshold matrix is ​​constructed: the matrix rows correspond to the three constraint levels, the matrix columns correspond to each heterogeneous knowledge base, and the matrix elements... Let be the constraint tolerance threshold of the j-th knowledge base at level L.

[0232] Step 33: Combining the field constraint hierarchy division results with the constraint tolerance thresholds of each heterogeneous knowledge base, configure cross-database unified constraint execution rules and single-database adapted fault tolerance thresholds for each constraint hierarchy; among which, the core constraint layer is configured with exact matching hard filtering rules, the support constraint layer is configured with semantic weighted matching rules, and the auxiliary constraint layer is configured with post-relevance verification rules.

[0233] This step is designed to adapt to the varying capabilities of different heterogeneous knowledge bases while maintaining a unified constraint enforcement standard. This ensures consistent constraint definitions across different knowledge bases while preventing the erroneous exclusion of valid knowledge bases due to insufficient capabilities of a single knowledge base. Taking the field constraint hierarchy division results and constraint tolerance threshold matrix as input, this step sets unified cross-database execution rule logic for each of the three constraint levels, calculates the single-database adaptation fault tolerance threshold for each knowledge base, and finally outputs the rule configuration and threshold parameters for each level. Specifically, this includes:

[0234] Step 331: Configuration principles for constraint execution rules and fault tolerance thresholds

[0235] First, clarify the overall principles of the two-level configuration to ensure a balance between rule consistency and inter-database compatibility:

[0236] Rule consistency principle: The same matching logic and filtering timing are executed in all knowledge bases at the same constraint level to ensure the consistency of constraint execution standards and avoid constraint deviations in cross-database recall results;

[0237] Threshold adaptability principle: Based on the constraint tolerance threshold of each knowledge base, the fault tolerance threshold of each knowledge base at the corresponding level is set differently; the stronger the constraint tolerance capacity of the knowledge base, the stricter the fault tolerance threshold; the weaker the constraint tolerance capacity of the knowledge base, the more relaxed the fault tolerance boundary is, so as to achieve the optimal balance between constraint fidelity and recall coverage.

[0238] The principle of decreasing hierarchy: from the core constraint layer to the auxiliary constraint layer, the constraint execution strength decreases step by step, the fault tolerance increases step by step, and the matching accuracy requirement is relaxed step by step, which completely corresponds to the importance level of the constraint hierarchy.

[0239] Step 332: Configure core constraint layer execution rules and fault tolerance thresholds

[0240] The core constraint layer corresponds to the rigid constraints of the query, and adopts exact matching hard filtering rules. The execution time is in the pre-retrieval stage, that is, constraint filtering is performed before candidate fragment retrieval.

[0241] (1) Unified constraint enforcement rules across databases

[0242] The specific execution logic for exact matching hard filter rules is as follows:

[0243] For all constraint semantic units contained in the core constraint layer, the field values ​​corresponding to candidate fragments must be strictly equivalent to the constraint values, or conform to the equivalent mapping of domain standard coding; candidate fragments that do not meet the matching conditions are directly filtered out and will not enter the subsequent semantic retrieval, sorting and fusion stages, and will not participate in any subsequent scoring calculations.

[0244] During the matching process, enumerated, numeric, and time fields undergo strict equality matching; string fields undergo standardized equality matching. Standardization operations include case unification, full-width / half-width character conversion, domain standard encoding mapping, and format normalization.

[0245] 2) Single-database adaptation fault tolerance threshold calculation: For the j-th heterogeneous knowledge base, the fault tolerance threshold of its core constraint layer is calculated based on the corresponding constraint tolerance threshold, and the formula is as follows:

[0246] ;

[0247] in, The constraint tolerance threshold of the j-th knowledge base in the core constraint layer is calculated by step 32. The core layer fault tolerance coefficient has a value range of [0.9, 1.0], and in this embodiment, it is 0.95. This coefficient is close to 1, which indicates that the core constraint layer only allows a very small constraint strength margin to ensure the strictness of rigid constraints.

[0248] Knowledge base adaptation determination

[0249] If the total constraint strength of the current query core constraint layer is less than or equal to If the total constraint strength is greater than the fault tolerance threshold, the knowledge base is determined to have the full execution capability of the core constraint layer and can participate in the retrieval and recall of the core constraint layer; if the total constraint strength is greater than the fault tolerance threshold, the knowledge base is determined to be unable to bear the core constraints and will not be included in the core constraint retrieval path, and can only participate in the auxiliary retrieval of a lower level.

[0250] Step 333: Configure execution rules and fault tolerance thresholds for the support constraint layer

[0251] The support constraint layer provides elastic constraints for the corresponding queries, employing semantically weighted matching rules. The execution timing is during the retrieval and ranking fusion stage, meaning that the constraints participate in scoring and ranking rather than being forcibly filtered.

[0252] (1) Unified constraint enforcement rules across databases

[0253] The specific execution logic of the semantically weighted matching rule is as follows:

[0254] For all constraint semantic units contained in the supporting constraint layer, strict equality of field values ​​is not required. Values ​​that are semantically equivalent, range compatible, or subordinate are allowed to be matched. The semantic matching degree is calculated for each constraint field. The matching degree value ranges from [0,1], with 1 for a complete match and 0 for a complete mismatch. Semantic partial matches are assigned values ​​based on semantic similarity.

[0255] The matching degree of all supporting constraint fields is weighted and summed according to the inherent constraint strength to obtain the comprehensive matching score of the supporting constraints of the candidate segment. This score directly participates in the final comprehensive ranking of candidate segments, with higher matching degree ranking higher; segments with a comprehensive matching degree below the minimum threshold are excluded.

[0256] (2) Calculation of single-library adaptation fault tolerance threshold

[0257] (3) For the j-th heterogeneous knowledge base, the fault tolerance threshold of its support constraint layer is calculated based on the corresponding constraint tolerance threshold, and the formula is:

[0258] ;

[0259] in: The constraint tolerance threshold of the j-th knowledge base in the support constraint layer is calculated by step 32; The fault tolerance coefficient of the support layer has a value range of [0.7, 0.9], and is 0.8 in this embodiment. This coefficient is lower than that of the core layer, which indicates that the support constraint layer is allowed to appropriately relax the constraint strength boundary and compensate for part of the constraint loss through semantic matching.

[0260] At the same time, configure a minimum matching threshold for a single database to control the bottom line for downgraded matching:

[0261] ;

[0262] in This is the minimum comprehensive matching threshold for the supporting constraint fields of this knowledge base; candidate fragments below this threshold are discarded.

[0263] (3) Knowledge base adaptation determination:

[0264] If the total constraint strength of the current query supporting constraint layer is less than or equal to If the knowledge base is found to be capable of supporting the complete execution of the constraint layer, then a downgraded matching is performed, retaining only the segments with a matching degree higher than the lowest threshold. If the knowledge base is found to be unable to support the execution of the constraint at this level, then the knowledge base is determined to be unable to support the execution of the constraint at this level.

[0265] Step 334: Configure the auxiliary constraint layer execution rules and fault tolerance thresholds. The auxiliary constraint layer provides supplementary constraints for the corresponding query. It adopts a post-relevance verification rule and is executed in the post-verification stage after the initial sorting of candidate fragments. It does not participate in the pre-recall filtering.

[0266] (1) The specific execution logic of the cross-database unified constraint execution rule followed by the correlation check rule is as follows:

[0267] In the retrieval and initial ranking stages, no field filtering of the auxiliary constraint layer is applied, and all candidate fragments are initially ranked according to semantic similarity. Based on the initial ranking results, the relevance between each candidate fragment and the auxiliary constraint field is calculated in the post-processing stage. The relevance is added to the initial ranking score as a ranking bonus. Only the ranking order is optimized, and no fragment removal operation is performed.

[0268] The relevance calculation comprehensively considers the semantic overlap of fields, the degree of contextual relevance, and the degree of topic fit. The value range is [0,1]. The higher the relevance, the greater the bonus.

[0269] (2) Single-database adaptation fault tolerance threshold calculation: For the j-th heterogeneous knowledge base, the fault tolerance threshold of its auxiliary constraint layer is calculated based on the corresponding constraint tolerance threshold, and the formula is as follows:

[0270] ;

[0271] in, The constraint tolerance threshold of the j-th knowledge base in the auxiliary constraint layer is calculated by step 32. The auxiliary layer tolerance coefficient ranges from [0.4, 0.6], and is set to 0.5 in this embodiment. This coefficient is significantly lower than the first two levels, indicating that the auxiliary constraint layer greatly relaxes the constraint strength boundary and is only used as a reference for ranking optimization, without mandatory matching. At the same time, a single-database relevance scoring weight is configured: the higher the knowledge base tolerance threshold, the greater the scoring weight of the auxiliary constraint; the lower the tolerance threshold, the smaller the scoring weight, to avoid the auxiliary constraints of weak capability knowledge bases from causing excessive interference to the ranking.

[0272] Step 335: Structured encapsulation of hierarchical rules and thresholds

[0273] After completing the rule configuration and threshold calculation for the three constraint levels, all rule parameters, threshold values, and adaptation judgment results are structurally encapsulated to generate a hierarchical rule configuration table. This table contains the execution rule type, execution timing, matching logic description for each constraint level, as well as information such as the fault tolerance threshold, minimum matching degree, and adaptation status for each level corresponding to each heterogeneous knowledge base.

[0274] Step 34: Integrate the field constraint hierarchy division results, the constraint tolerance thresholds of each knowledge base, and the constraint execution rules of each level to generate constraint classification information.

[0275] In this embodiment, step 4 is used to transform the constraint grading results and multi-knowledge base capability quantification data into an executable retrieval scheme. It determines the constraint adaptation level of each knowledge base through loss assessment, achieves decoupled recall of semantics and constraints through a dual-space architecture, matches constraint execution strength through hierarchical fusion rules, and achieves globally optimal multi-path recall combinations through path optimization. Finally, it outputs a standardized, executable retrieval strategy, providing precise execution basis for subsequent candidate recall stages. Specifically, it includes:

[0276] Step 41: Calculation of constraint propagation loss coefficient and determination of the highest constraint execution level

[0277] Extract the dimensional capability scores of each heterogeneous knowledge base from the three-dimensional multi-knowledge base field capability tensor, combine the field constraint level division results in the constraint grading information with the constraint tolerance threshold of each knowledge base, calculate the constraint propagation loss coefficient of each heterogeneous knowledge base under the core constraint layer, supporting constraint layer and auxiliary constraint layer, and determine the highest constraint execution level that each knowledge base can adapt to.

[0278] The constraint propagation loss coefficient characterizes the degree of constraint strength attenuation after cross-knowledge base field mapping and structural transformation. A higher loss coefficient indicates lower constraint fidelity and greater deviation in execution performance. For the j-th heterogeneous knowledge base and the L-th constraint level, the formula for calculating the constraint propagation loss coefficient is:

[0279] ;

[0280] in, The set of all constraint semantic units contained in the Lth constraint level; The topology preservation capability score of the i-th constraint semantic unit under the j-th heterogeneous knowledge base is taken from the third channel of the three-dimensional multi-knowledge base field capability tensor, with a value range of [0,1]. The intrinsic constraint strength quantization value of the i-th constraint semantic unit is taken from the calculation result of step 21, with a value range of [0,1]. Let be the constraint propagation loss coefficient of the j-th heterogeneous knowledge base at the L-th constraint level. Its value ranges from [0,1]. The larger the value, the higher the strength loss during the constraint propagation process.

[0281] Based on the loss coefficient and constraint tolerance threshold, the highest constraint execution level that each heterogeneous knowledge base can adapt to is determined in descending order of hierarchy, according to the following rules:

[0282] Core constraint layer adaptation determination: If both conditions are met simultaneously, the knowledge base is determined to be adaptable to the core constraint layer and supports constraint execution at all levels.

[0283] Core constraint layer constraint propagation loss coefficient ,in The core layer loss threshold is set to 0.2 in this embodiment;

[0284] The current query shows the total constraint strength of the core constraint layer. ,in The fault tolerance threshold for the core layer of this knowledge base is taken from step 33.

[0285] Support constraint layer adaptation determination: If the core layer adaptation conditions are not met, but both conditions are met, then the knowledge base is determined to be adaptable to the support constraint layer, and only the execution of constraints in the support and auxiliary layers is supported.

[0286] Support constraint layer constraint propagation loss coefficient ,in The support layer loss threshold is set to 0.35 in this embodiment;

[0287] The current query supports the total constraint strength of the constraint layer. ,in The fault tolerance threshold for the knowledge base support layer is taken from step 33.

[0288] Auxiliary constraint layer adaptation determination: If the support layer adaptation condition is not met, but the auxiliary constraint layer constraint propagation loss coefficient is... ,in The threshold for auxiliary layer loss is set to 0.5 in this embodiment. Therefore, it is determined that the knowledge base can be adapted to the auxiliary constraint layer and only supports auxiliary layer constraint verification.

[0289] Misfit determination: If none of the above three-layer adaptation conditions are met, the knowledge base is determined to have insufficient constraint adaptation and is not included in the target knowledge base scope of this search.

[0290] After determining the hierarchy of all knowledge bases, a knowledge base-adaptation hierarchy mapping table is generated as the basis for subsequent path optimization.

[0291] Step 42: Construction of the dual-space retrieval architecture:

[0292] Based on the constraint execution rules of each constraint level in the constraint hierarchy information, a dual-space retrieval architecture with independent semantic retrieval branch and constraint retrieval branch is constructed. The semantic retrieval branch is used to perform pure semantic similarity recall, and the constraint retrieval branch is used to perform constraint topology matching recall. The two branches independently complete similarity calculation and initial ranking.

[0293] This architecture splits the traditional single retrieval space into two decoupled parallel retrieval channels: a semantic space and a constraint space. This avoids interference between semantic features and constraint features within a single space. Furthermore, the fusion method of the two channels can be flexibly adjusted for different constraint levels to adapt to varying constraint execution intensities. The specific structure of the two channels is as follows:

[0294] Semantic retrieval branch:

[0295] This branch uses the core semantic content of the query as the sole retrieval input and employs a dense vector retrieval paradigm to achieve pure semantic recall. Its execution logic is as follows: extract the semantic units of the query subject and the core request text from the user query, encode them into a high-dimensional semantic query vector using a pre-trained semantic encoding model; perform an approximate nearest neighbor search in the text vector indexes of various heterogeneous knowledge bases, sort them according to cosine similarity from high to low, and return the set of text fragments with the most semantic relevance.

[0296] This branch only focuses on the semantic relevance of the text content and does not impose any structured field constraints or filtering. Its output only carries a semantic similarity score to ensure the semantic coverage of the recall results.

[0297] Constrained retrieval branches:

[0298] This branch uses the field constraint topology graph as the core retrieval input and employs a structured graph matching paradigm to achieve constraint topology retrieval. Its execution logic is as follows: extract the constraint semantic units and topological relationships at the corresponding constraint level; encode the field constraint topology graph into graph structure feature vectors and structured query expressions; perform topology structure matching retrieval in the structured field indexes of various heterogeneous knowledge bases; calculate the graph edit distance between the field set corresponding to the candidate fragment and the original constraint topology; obtain the topology matching score; and return the results sorted from high to low matching scores.

[0299] This branch only focuses on the structural matching degree of field constraints and does not perform full-text semantic similarity calculation. Its output carries the set of constraint matching fields and the topological matching degree score to ensure the constraint compliance of the recall results.

[0300] The two branches are configured with independent index resources, retrieval operators and initial ranking models, and execute retrieval tasks in parallel, each outputting an independent initial ranking candidate set.

[0301] Step 43: Configure hierarchical dual-space fusion rules and recall control parameters

[0302] Differentiated dual-space fusion rules and recall control parameters are configured for the core constraint layer, supporting constraint layer, and auxiliary constraint layer: the core constraint layer adopts a fusion rule of hard filtering of constraint branches followed by semantic branch reordering; the supporting constraint layer adopts a fusion rule of weighted calculation of dual-space scores; and the auxiliary constraint layer adopts a fusion rule of post-validation of constraint branches after semantic branch recall. At the same time, corresponding recall quantity and similarity threshold parameters are configured for each constraint layer.

[0303] This step designs a fusion logic and parameter thresholds that are gradually relaxed based on the differences in the execution strength of the three layers of constraints, achieving a layered match between constraint rigidity and recall flexibility. The specific configuration is as follows:

[0304] Core constraint layer fusion rules and recall control parameters:

[0305] A fusion model of constraint pre-filtering and semantic post-sorting is adopted to prioritize constraint compliance and then optimize semantic relevance.

[0306] The specific execution process is as follows: First, the constraint retrieval branch performs precise matching and filtering of the core constraint fields, outputting a set of all candidate segments that meet the core constraint conditions, and directly eliminating segments that do not meet the conditions; then, the set is input into the semantic retrieval branch, and re-sorted according to semantic similarity from high to low to obtain the final core layer candidate ranking list.

[0307] Recall control parameter configuration: The maximum number of recalls per knowledge base per channel is 50, the minimum threshold for semantic similarity is 0.6, and the minimum threshold for constraint matching degree is 1.0 (i.e., perfect match).

[0308] Support constraint layer fusion rules and recall control parameters

[0309] A dual-path parallel recall and score-weighted fusion mode is adopted to balance constraint matching degree and semantic relevance.

[0310] The specific execution process is as follows: the semantic retrieval branch and the constraint retrieval branch each output their initial ranked candidate sets and corresponding scores; the scores of the same candidate fragment returned by the two branches are weighted and fused, and the fused score is calculated using the following formula:

[0311] ;

[0312] in, The semantic similarity score is the output of the semantic retrieval branch, with a value range of [0,1]. To constrain the topology matching score output by the retrieval branch, the value range is [0,1]. The semantic score weight is set to 0.4 in this embodiment; To constrain the scoring weight, this embodiment uses 0.6.

[0313] Sort the candidates for the support layer from highest to lowest according to their fusion scores, and output the candidate ranking list.

[0314] Recall control parameter configuration: The maximum number of recalls per knowledge base per channel is 80, the minimum threshold for semantic similarity is 0.4, and the minimum threshold for constraint matching degree is equal to the minimum matching degree threshold of the supporting layer of the corresponding knowledge base.

[0315] Auxiliary constraint layer fusion rules and recall control parameters

[0316] A fusion model of semantic pre-recall and constraint post-score supplementation is adopted to prioritize recall coverage, while constraints are only used as a reference for ranking optimization.

[0317] The specific execution flow is as follows: First, the semantic retrieval branch outputs an initial ranked candidate fragment set; then, the constraint retrieval branch performs post-match verification of auxiliary constraint fields on each fragment in this set, calculates the auxiliary constraint matching degree, and adds it as a bonus to the semantic score. No fragment removal operation is performed; only the ranking order is adjusted. The corrected score calculation formula is as follows:

[0318] ;

[0319] in, The auxiliary constraint matching score has a value range of [0,1]. To supplement the scoring weight for the constraint, this embodiment uses 0.15.

[0320] Recall control parameter configuration: The maximum number of recalls per knowledge base per channel is 100, the minimum semantic similarity threshold is 0.3, and there is no mandatory constraint on the matching threshold.

[0321] The overall process of hierarchical dual-space fusion and ranking described above is shown in Figure 4. After the semantic retrieval branch and the constraint retrieval branch output candidate results respectively, the system performs differentiated processing based on the constraint hierarchical results: candidate fragments that violate the mandatory conditions of the core constraint layer are directly filtered and marked as prohibited from citation; fragments that meet the conditions of the supporting constraint layer receive corresponding ranking gains; auxiliary constraint layer conditions are only recorded as hits and do not affect the basic ranking. All compliant fragments are fused and calculated to obtain the final evidence score, which is used for subsequent evidence chain screening.

[0322] Step 44: Multi-path Recall Optimization and Executable Retrieval Strategy Generation. Based on the constraint propagation loss coefficients of each knowledge base, a path optimization algorithm is used to select the multi-path recall combination with the minimum cumulative constraint loss. This is combined with fusion rules and recall control parameters at the corresponding constraint level to generate an executable retrieval strategy that includes recall paths, retrieval operators, ranking rules, and threshold parameters. This step aims to optimize global constraint fidelity. While covering all core constraints, it selects the optimal multi-knowledge base recall combination, specifically including:

[0323] Optimization Modeling:

[0324] Each heterogeneous knowledge base is considered as a node in the optional path. The weight of a node is the constraint propagation loss coefficient of the corresponding adaptation level of that knowledge base. The total path loss is the weighted average of the loss coefficients of all selected nodes, with the weight being the proportion of constraint strength covered by each knowledge base. The objective function for optimization is to minimize the total cumulative constraint loss of the path, with the constraint condition that the set of covered fields of the selected knowledge base combination must contain the constraint semantic units of all core constraint layers.

[0325] Pathfinding:

[0326] The optimal path combination is solved by using a constrained dynamic programming algorithm. All feasible subsets of the knowledge base are traversed, and the top K recall path combinations that meet the core constraint coverage conditions and have the minimum cumulative constraint loss are selected. In this embodiment, K is 3, forming a multi-level recall scheme with main path and backup path.

[0327] In this embodiment, the constrained dynamic programming algorithm is solved as follows:

[0328] State definition: Let This represents the minimum cumulative constraint loss when selecting several knowledge bases from the first i knowledge bases to cover the constraint node set mask; where mask is a binary mask, each bit corresponds to a constraint semantic unit, 1 indicates that the constraint is covered, and 0 indicates that it is not covered.

[0329] Initial state: The initial values ​​for the remaining states are set to infinity.

[0330] State transition: For the i-th knowledge base, the mask of the constraint nodes that it can cover is... The corresponding loss coefficient is Then the recurrence relation is:

[0331]

[0332] ;

[0333] The goal is to traverse all mask states containing all core constraint nodes and select the top K knowledge base combinations with the minimum total loss, which is the optimal recall path.

[0334] Strategy encapsulation:

[0335] For each recall path, match the corresponding constraint level of dual-space fusion rules, retrieval operator set, and recall control parameters to generate a structured, executable retrieval strategy. The strategy includes the following core components:

[0336] Target knowledge base list: Identifiers of all heterogeneous knowledge bases participating in this search, and the highest constraint execution level corresponding to each knowledge base;

[0337] Retrieval operator configuration: vector model identifier, encoding dimension, and approximate retrieval algorithm for semantic retrieval branches; graph matching algorithm, field mapping rules, and matching calculation method for constraint retrieval branches;

[0338] Merging and sorting rules: dual-space fusion logic corresponding to the constraint level, score calculation formula, sorting dimensions and priorities;

[0339] Threshold parameter set: recall limit, semantic similarity threshold, constraint matching threshold, and loss tolerance threshold corresponding to each level;

[0340] Execution timing conventions: parallel startup instructions, result callback methods, and exception fallback paths.

[0341] The generated executable retrieval strategy serves as the basis for execution in subsequent multi-path candidate recall stages, ensuring that the retrieval process strictly adheres to the constraint hierarchy requirements and achieves the global optimum of constraint fidelity and recall coverage.

[0342] Step 5 executes retrieval and recall in parallel across multiple heterogeneous knowledge bases according to the recall path, dual-space architecture, and hierarchical fusion rules agreed upon in the retrieval strategy. Simultaneously, a topology drift compensation mechanism is introduced to correct constraint structure deviations caused by cross-database field mapping. Finally, the deduplication and normalization of cross-database results are completed, along with standardized attribute annotations, outputting a set of candidate answer fragments with constrained attributes, providing basic input for the subsequent construction of the answer evidence package. This step specifically includes:

[0343] Step 51: Dual-branch parallel retrieval and candidate fragment set generation

[0344] Based on the multi-path recall path, dual-space fusion rules, and threshold parameters determined by the executable retrieval strategy, semantic retrieval branch and constraint retrieval branch are launched in parallel in each target heterogeneous knowledge base. The semantic retrieval branch performs dense recall based on pure semantic vector similarity to generate a set of semantic candidate fragments. The constraint retrieval branch performs structured recall based on constraint topology matching degree to generate a set of constraint candidate fragments.

[0345] For each target heterogeneous knowledge base, based on its highest constraint execution level, the corresponding configured index resources and retrieval operators are invoked to execute the retrieval tasks of two branches in parallel. The two branches do not interfere with each other and output the initial sorting results independently.

[0346] Semantic retrieval branch execution flow:

[0347] First, extract the semantic units of the query subject and the core request text from the user query, and concatenate them into a semantic retrieval query text; input the query text into a pre-trained semantic encoding model to generate a fixed-dimensional semantic query vector.

[0348] Subsequently, an approximate nearest neighbor search is performed in the dense vector index of the target knowledge base. This embodiment uses a hierarchical navigable small-world graph index, with cosine similarity as the metric, to return a preset number of text fragments ranked high in similarity, forming a semantic candidate fragment set. Each fragment is accompanied by four basic pieces of information: semantic similarity score, fragment unique identifier, document identifier, and original text content.

[0349] The semantic similarity score ranges from [0,1], with higher values ​​indicating stronger semantic relevance between the fragment and the query. The recall count and minimum similarity threshold strictly follow the parameter configuration of the corresponding constraint level in the executable retrieval strategy.

[0350] Constraint retrieval branch execution flow:

[0351] First, extract the constraint semantic units and topological relationships corresponding to the adaptation level of the knowledge base. Then, map the query constraint fields to the local fields of the target knowledge base through field mapping rules, and construct a structured query condition and constraint topology template.

[0352] For the knowledge base adapted to the core constraint layer, perform exact matching retrieval: perform equal-value filtering on all core constraint fields, filter out candidate fragments that match perfectly, calculate the graph edit distance between the constraint topology and the original topology, obtain the topology matching score, and return them in descending order of score.

[0353] For the knowledge base that supports the constraint layer adaptation, perform semantic weighted matching retrieval: allow fields to have semantically equivalent values, calculate the semantic matching degree for each field and sum them up according to the inherent constraint strength to obtain a comprehensive constraint matching score, combine it with the topology matching degree to obtain the final topology matching degree score, and return it in sorted order.

[0354] All returned fragments form a set of constraint candidate fragments. Each fragment is accompanied by four basic pieces of information: topological matching score, set of matching constraint fields, fragment unique identifier, and document identifier. The recall number and minimum matching threshold strictly follow the corresponding parameter configuration in the executable retrieval strategy.

[0355] The two branch retrieval tasks of all target knowledge bases are started in parallel through multi-threaded asynchronous methods, and all retrieval results are aggregated through a callback mechanism to ensure the execution efficiency of multi-path retrieval.

[0356] Step 52: Topology Drift Detection and Compensation Recall. For the recall paths corresponding to the core constraint layer and supporting constraint layer, the topology drift amount after cross-knowledge base mapping of the field constraint topology is calculated in real time. If the topology drift amount exceeds a preset compensation threshold, the retrieval vector of the constraint retrieval branch is corrected in the opposite direction of the drift, and supplementary recall after drift compensation is performed to update the constraint candidate fragment set. Due to the inherent differences in the field system and index structure of heterogeneous knowledge bases, problems such as missing fields, broken relationships, and structural deformation may occur after the original field constraint topology is mapped to the target knowledge base, leading to a shift in the constraint topology structure and reducing constraint fidelity. This step corrects this deviation through drift detection and targeted compensation to ensure the consistency of cross-database constraint execution.

[0357] Topology drift calculation:

[0358] Let the original field constraint topology be denoted as The actual constraint topology graph mapped to the j-th knowledge base is denoted as . The graph edit distance is used to measure the structural difference between two graphs, which is the minimum number of operations required to transform one graph into another through node addition and deletion and edge addition and deletion operations.

[0359] The formula for calculating topology drift is:

[0360] ;

[0361] in, The graph edit distance between the two graphs; Constrain the total number of vertices in the topology graph for the original field; This is the normalized topology drift, with a value range of [0,1]. A higher value indicates a greater topology shift.

[0362] Drift compensation triggering and execution:

[0363] Preset topology drift compensation threshold It can be adjusted as needed based on the stringency of the constraints in the scenario. If the calculated topology drift... If this occurs, the drift compensation mechanism will be triggered.

[0364] First, analyze the drift direction: statistically analyze the missing constraint nodes and broken constraint edges after mapping, extract the semantic features corresponding to the missing parts, and generate a reverse compensation semantic vector; then, superimpose the compensation vector onto the original constraint retrieval vector according to the drift amount, and correct the retrieval direction in the opposite direction of drift.

[0365] Specifically, the drift direction is first quantized: all missing constraint semantic units after statistical mapping are statistically analyzed, the semantic encoding vector of each missing unit is extracted, and the vectors are weighted and summed according to the inherent constraint strength of each unit to obtain the drift direction vector.

[0366] ;

[0367] in Let be the semantic encoding vector of the i-th constraint semantic unit.

[0368] Then, a reverse compensation vector is generated: ,in To compensate for the step size coefficient, this embodiment uses 0.3; the compensation vector is superimposed on the original constraint retrieval vector to obtain the corrected retrieval vector, which is used to supplement the recall.

[0369] This application first quantifies the degree of topological offset using normalized graph editing distance, then obtains the drift direction vector by weighting the semantic vectors of missing constraint nodes according to constraint strength, and generates a compensation vector along the opposite drift direction according to the drift ratio to achieve directional drift correction. It can automatically identify the degree of topological offset and correct the retrieval direction, improving the structural fidelity of cross-database constraints without significantly increasing recall costs, and solving the technical problem of progressive distortion of constraint structures in multi-knowledge-base scenarios.

[0370] The revised retrieval vector is used to perform supplementary recall, which returns newly added candidate fragments. The fragments in the supplementary recall are compared with the original set of constrained candidate fragments to remove duplicate fragments and then the set of constrained candidate fragments is updated to complete the drift compensation.

[0371] The drift compensation mechanism can effectively reduce the distortion of constraint structure caused by cross-database field mapping, and improve the constraint matching accuracy and recall completeness in multi-knowledge base scenarios.

[0372] Step 53: Cross-database deduplication, granularity normalization, and attribute annotation:

[0373] Cross-database deduplication and fragment granularity normalization are performed on all semantic candidate fragment sets and constraint candidate fragment sets returned by the knowledge base. Each candidate fragment is labeled with four attributes: constraint matching field set, topological matching degree, semantic matching degree, and source knowledge base identifier, generating candidate answer fragments labeled with constraint attributes.

[0374] Cross-database deduplication:

[0375] A dual deduplication rule is adopted, which uses document identifiers and joint text similarity:

[0376] If two candidate segments come from the same document and have the same segment identifier, the segment with the higher score is retained and duplicates are removed.

[0377] If two candidate segments come from different knowledge bases or different documents, the SimHash algorithm is used to calculate the text overlap. If the overlap exceeds 80%, it is determined to be a duplicate segment. The segment with higher topological matching degree and higher source authority is retained, and the remaining duplicate segments are removed.

[0378] After deduplication, a complete set of candidate segments without duplicates is obtained.

[0379] Fragment granularity normalization processing:

[0380] All candidate fragments are uniformly adjusted to a standard semantic granularity, that is, the complete semantic sentence is used as the basic unit, and the length of a single fragment token is controlled between 128 and 512.

[0381] For long segments that exceed the upper limit, they are segmented according to semantic boundaries and split into multiple independent standard-granularity segments;

[0382] For short fragments that are shorter than the lower limit, supplement them with the surrounding context statements in the document to expand them to the standard granularity range;

[0383] After granularity normalization, the text granularity of all candidate segments remains consistent, which facilitates the subsequent construction of evidence chains and unified processing by large models.

[0384] Standardized attribute annotation:

[0385] Each candidate fragment is labeled with four standardized attributes to form a complete constraint attribute profile:

[0386] Constraint matching field set: records all constraint semantic unit identifiers matched by this fragment, and is hierarchically marked according to the core constraint layer, supporting constraint layer, and auxiliary constraint layer;

[0387] Topology matching degree: The degree of matching between the constraint structure corresponding to this segment and the original field constraint topology graph. The value range is [0,1], and it is calculated by the constraint retrieval branch.

[0388] Semantic matching score: The semantic similarity score between this fragment and the query subject, with a value range of [0,1], calculated by the semantic retrieval branch;

[0389] Source knowledge base identifier: The unique identifier of the heterogeneous knowledge base to which the fragment belongs, the metadata identifier of the corresponding document, and the position offset of the fragment in the original document, which are used for subsequent tracing and auditing.

[0390] After all processing and annotation are completed, a standardized set of candidate answer fragments is generated.

[0391] Step 6 transforms discrete candidate response fragments into a structured, traceable evidence system. Using the original field constraint topology graph as a framework, fragments are combined and evidence chains are constructed. Conflict resolution addresses contradictions in multi-source data. After multi-dimensional quality assessment and ranking, the evidence is packaged into a standardized response evidence package. This step specifically includes:

[0392] Step 61: Construction of Candidate Evidence Chain Topology

[0393] Using the field constraint topology graph as the skeleton structure, each candidate answer fragment is mapped to the constraint topology space, and fragments covering the corresponding constraint level nodes and topological relationships are filtered and combined to generate multiple candidate evidence chains with matching topological structures.

[0394] This step uses the constraint topology as the evidence organization framework to ensure that the generated chain of evidence is structurally consistent with the original constraints. The specific process is as follows:

[0395] Fragment topology mapping:

[0396] For each candidate answer fragment, based on its labeled set of constraint matching fields, the fragment is mapped to the corresponding vertex of the field constraint topology graph, and all constraint nodes covered by the fragment and the topological association edges that can be supported between the nodes are marked, forming the topology covering subgraph corresponding to the fragment.

[0397] For an edge that cannot be directly covered by a single fragment, if two adjacent constraint nodes are covered by different fragments, and the semantic logic of the two fragments supports the existence of the association, then the edge is determined to be an edge that can be indirectly covered and is included in the coverage statistics.

[0398] Evidence chain generation:

[0399] A greedy path search algorithm is used to construct candidate evidence chains: all nodes in the core constraint layer are taken as the starting point for mandatory coverage, and the chain is expanded sequentially along the directed edges of the topology graph. Each time, the candidate segment with the largest number of uncovered nodes and the highest topology matching degree is selected to be added to the evidence chain, and the topology coverage is gradually expanded until no more nodes can be added or the maximum number of segments in a single evidence chain is reached.

[0400] Each chain of evidence consists of several candidate response fragments linked together in a topological logical order, and must meet the minimum coverage requirements: it must completely cover all core constraint layer nodes, and the overall topological node coverage rate must not be less than 60% of the total number of nodes.

[0401] Multipath generation:

[0402] By adjusting the priority of fragment selection and the starting point of the search, the path search process is repeated to generate multiple candidate evidence chains with different fragment combinations; all candidate evidence chains constitute a candidate evidence chain set, which is used for subsequent conflict resolution and sorting and filtering.

[0403] Step 62: Resolution of conflicts among multiple sources of evidence:

[0404] Identify candidate segments in different candidate evidence chains that have conflicting field values ​​or logical relationships, calculate the manifold alignment of each conflicting segment with the original field constraint topology graph, retain conflicting segments with manifold alignment higher than a preset threshold, and remove segments with low alignment to complete the conflict resolution of multi-source evidence.

[0405] Because heterogeneous knowledge bases differ in data sources, update cycles, and statistical methods, candidate fragments from different sources may exhibit contradictory constraint field values ​​and mutually exclusive logical relationships. This step uses manifold alignment evaluation to automatically resolve these conflicts, preserving evidence with higher overall consistency to the original constraints. The specific process is as follows:

[0406] Conflict fragment identification:

[0407] Traverse all candidate segments in the candidate evidence chain and group them for identification according to two types of conflict rules:

[0408] Field value conflict: For the same constraint semantic unit, if the field values ​​corresponding to different segments are mutually exclusive, contradictory, or cannot be true at the same time, these segments are marked as the same group of field value conflict segments.

[0409] Logical relationship conflict: For the association relationship of the same pair of constraint nodes, if different segments support opposite logical relationship types (such as the coexistence of limiting relationship and mutual exclusion relationship), these segments are marked as the same set of logical relationship conflict segments.

[0410] Manifold alignment calculation:

[0411] For each conflicting segment, its manifold alignment with the original field constraint topology is calculated. This manifold alignment characterizes the overall fit between the segment and the original constraints in the joint semantic and constraint feature space. The formula for calculating the manifold alignment is:

[0412] ;

[0413] in, The angle between the joint feature vector of the segment and the principal direction of the original constrained topological manifold is obtained by concatenating semantic features and constraint features and calculating the cosine angle. The smaller the angle, the higher the overall fit. The number of constraint nodes matched for this segment; Constrain the total number of nodes in the topology graph for the field; This represents the manifold alignment, with a value range of [0,1]. A higher value indicates a stronger overall consistency between the segment and the original constraint.

[0414] This application introduces the concept of manifold alignment into the scenario of resolving conflicts in multi-source evidence. It judges the retention or rejection of conflicting evidence based on the overall fit of the global constraint topology, rather than judging the correctness or incorrectness of a single field in isolation. The resolution result is more in line with the overall constraint logic, effectively improving the consistency and reliability of multi-source heterogeneous evidence.

[0415] In this embodiment, the supplementary manifold principal direction is obtained in the following manner:

[0416] Extract the semantic encoding vectors of all constraint semantic units in the field constraint topology graph to form a feature matrix. , where N is the total number of constraint nodes and d is the semantic vector dimension; perform principal component analysis (PCA) on the feature matrix, and take the eigenvector corresponding to the first principal component as the principal direction vector of the original constraint topological manifold.

[0417] The joint feature vector of the conflicting segments is obtained by concatenating the textual semantic vector of the segments with the average semantic vector of the matching constraint nodes, followed by dimensionality reduction. The dimension aligns with the principal direction of the manifold; the cosine of these two vectors is the formula... .

[0418] Conflict resolution and handling:

[0419] The preset manifold alignment threshold is 0.6, which can be adjusted as needed based on the rigor of the business scenario. For each set of conflicting segments:

[0420] If there are segments in a group whose manifold alignment is higher than the threshold, retain the segment with the highest manifold alignment and remove the other conflicting segments in the group.

[0421] If the manifold alignment of all segments in a group is below the threshold, all conflicting segments in that group will be removed, and the relevant statements of the corresponding constraint points will not be retained in the evidence chain to avoid introducing contradictory information.

[0422] After processing all conflict groups, update the list of fragments in each candidate evidence chain, remove invalid fragments, and obtain a set of candidate evidence chains that have completed conflict resolution.

[0423] Step 63: Comprehensive scoring and fidelity labeling of the chain of evidence

[0424] For candidate evidence chains that have completed conflict resolution, a comprehensive scoring and ranking is performed based on three indicators: topological completeness, semantic coherence, and source credibility. A preset number of evidence chains with the highest ranking are selected, and each evidence chain is labeled with information on the fidelity of field matching, topological completeness, and source credibility.

[0425] This step involves screening high-quality evidence chains through multi-dimensional quality assessment and labeling them with fidelity information, providing a quantitative basis for attention allocation and credibility control in subsequent large-scale model generation. The specific process is as follows:

[0426] Single-dimensional indicator calculation:

[0427] For each candidate chain of evidence, three quality metrics are calculated:

[0428] Topological completeness: Characterizes the extent to which the chain of evidence covers the original constraint topology, and is calculated using the following formula:

[0429] ;

[0430] in, The number of constraint nodes covered by the chain of evidence. This represents the number of topological edges covered by the chain of evidence. , These represent the total number of nodes and the total number of edges in the original topology graph, respectively. The value range is [0,1].

[0431] Semantic coherence: Characterizes the smoothness of semantic connection among all segments within the chain of evidence. It is calculated by sequentially calculating the semantic similarity between any two adjacent segments in the chain of evidence, and taking the average of all adjacent similarities as the semantic coherence score, denoted as . The value range is [0,1].

[0432] Source credibility: Characterizes the authority of the source of the evidence chain data, and is calculated using the following formula:

[0433] ;

[0434] Where K is the total number of fragments in the chain of evidence. The constraint strength weight for the k-th segment is the sum of the inherent constraint strengths of the matching fields of the corresponding segment. The credibility level of the knowledge base to which the k-th segment belongs is rated, with a value range of [0,1]. The value range is [0,1].

[0435] Overall rating and ranking

[0436] The overall quality score of the evidence chain is calculated using a weighted summation of three indicators. The formula is as follows:

[0437] ;

[0438] in, , , These are the weighting coefficients for the three indicators. In this embodiment, they are set to 0.4, 0.3, and 0.3 respectively, but can be adjusted according to the emphasis requirements of the business scenario.

[0439] All candidate evidence chains are sorted from highest to lowest based on their overall scores, and the top N chains are selected as the final selected evidence chains. In this embodiment, N is set to 5. If the total number of candidate evidence chains is less than N, all of them are selected.

[0440] Fidelity rating:

[0441] For each selected chain of evidence, generate corresponding fidelity annotation information, including three annotation items:

[0442] Field matching degree: The proportion of the total number of constraint fields that match the chain of evidence to the total number of constraint fields;

[0443] Topological completeness: i.e., the topological completeness score calculated above. ;

[0444] Source credibility: i.e., the source credibility score calculated above. .

[0445] The fidelity labeling information is bound one-to-one with the evidence chain and is transmitted synchronously to subsequent stages along with the evidence chain.

[0446] Step 64: Structure and encapsulate the response evidence package

[0447] All candidate evidence chains after screening are integrated and packaged with corresponding fidelity annotation information to generate a structured answer evidence package.

[0448] This step integrates scattered evidence chains, fragments, and annotation information into a unified, standardized data structure, enabling structured encapsulation and traceable transmission of evidence. The response evidence package adopts a three-level hierarchical structure, specifically as follows:

[0449] Evidence package metadata layer

[0450] Located at the top level of the evidence package, this layer records global attribute information, including: a unique query identifier, a reference identifier for the original constraint topology diagram, a reference identifier for constraint hierarchy information, the total number of selected evidence chains, and a generation timestamp. This layer is used for global indexing and version management of the evidence package.

[0451] Chain of Evidence Structure Layer

[0452] Located in the middle layer of the evidence package, each selected evidence chain corresponds to a structural unit, recording: a unique identifier for the evidence chain, a comprehensive quality score, fidelity annotation information, the number of included fragments, a list of the logical order of the fragments, and the set of covered constraint nodes and edges. This layer is used to characterize the overall structure and quality attributes of the evidence chain.

[0453] Fragment Details Layer

[0454] Located at the bottom layer of the evidence package, each candidate response fragment corresponds to a details unit, recording: fragment unique identifier, fragment original content, constraint matching field set, topological matching score, semantic matching score, source knowledge base identifier, associated document metadata, and original text position offset. This layer is used to store the original content and source information of the evidence.

[0455] The encapsulated answer evidence package serves as a unified structured evidence carrier, which can be directly input into a large model to generate answers. It can clearly trace back the source fragments, constraint matching, and credibility level of each statement in the answer, achieving full-link connection between constraints and evidence.

[0456] The response evidence package carries the entire process of node-level evidence links, and its link structure is as follows: Figure 5As shown, the workflow covers all nodes from process initiation, field constraint generation, knowledge base retrieval, fusion and rearrangement, AI dialogue, to result output. Each workflow node retains a snapshot of the constraint object, candidate processing results, routing decisions, and error information at the corresponding moment. All nodes are linked together in the execution order to form a complete and traceable chain of evidence, supporting answer tracing and compliance auditing.

[0457] In this embodiment, step 7 is used to deeply couple the structured answer evidence package with the autoregressive decoding process of the large language model. Based on a preset large language model with basic autoregressive decoding capabilities, three customized mechanisms—structured attention constraints, dual-space feature constraints, and dynamic verification closed-loop constraints—are injected into the decoding link to deeply couple the hierarchical constraint rules in the answer evidence package into the entire generation process. Rigid control of constraints is achieved from three dimensions: attention allocation, feature fusion, and generation verification. The final output is answer information that meets the constraint hierarchical requirements and is traceable. The input to this step is the structured answer evidence package and the preset large language model; the output is answer information that matches the constraint hierarchical requirements. This step specifically includes:

[0458] Step 71: Construction of Constraint Topology-Driven Structured Attention Mask

[0459] Extract each evidence chain and its corresponding fidelity annotation information from the answer evidence package, and transform the constraint topology corresponding to the evidence chain into a structured attention mask for the large model decoding layer; wherein a forced attention mask is set at the evidence token position corresponding to the core constraint layer, and a weighted attention mask is set at the evidence token position corresponding to the support constraint layer, which is used to limit the attention allocation range and weight in the large model decoding process.

[0460] This step transforms the constraint hierarchy information into attention constraints that can be executed by the large model, forcing the model to prioritize higher-level constraints at the attention mechanism level. Specifically, this includes:

[0461] Evidence text tokenization and hierarchical tagging

[0462] For the text content of all evidence chains in the response evidence package, the native word segmenter of the large model is called to perform tokenization, resulting in an evidence token sequence and its corresponding position index. Based on the set of constraint matching fields labeled for each evidence fragment, the highest constraint level associated with each evidence token is marked, which is divided into three categories: core constraint layer, supporting constraint layer, and auxiliary constraint layer.

[0463] Hierarchical attention mask matrix generation

[0464] Construct an attention mask matrix with dimensions [maximum number of decoding steps, total number of evidence tokens]. This matrix is ​​a newly added constraint control parameter and is not part of the original input of the large model. The mask value rules strictly correspond to the constraint hierarchy:

[0465] The evidence token position associated with the core constraint layer has a fixed mask value of 1.0, which is defined as a mandatory attention mask. This requires that effective attention must be allocated to this position at each step of decoding, and it is not allowed to be masked.

[0466] The evidence token position that supports the constraint layer association has a mask value equal to the topological integrity score of the corresponding evidence chain (value range [0,1]), which is defined as a weighted attention mask, and attention weights are dynamically allocated according to constraint fidelity;

[0467] The evidence token position associated with the auxiliary constraint layer has a fixed mask value of 0.3, which is defined as an optional attention mask and is only used as a supplementary reference, not as a mandatory requirement.

[0468] Cross-attention link mask injection

[0469] During the cross-attention calculation in the large model's decoding layer, the natively calculated attention weight matrix is ​​multiplied element-wise with the aforementioned structured attention mask matrix to obtain the final attention weights after constraint correction. Subsequent feature-weighted summation is then performed. This injection operation is executed synchronously at each decoding step, forcing the model to prioritize higher-level constraints from the attention allocation perspective.

[0470] Step 72: Constraint Topological Feature Independent Projection and Dual-Space Decoding Fusion

[0471] Semantic features and constraint topological features of each evidence chain are extracted separately and mapped to the hidden feature space of a pre-defined large model through independent projection layers. Dual-space feature fusion is performed at each step of decoding to simultaneously constrain the semantic fluency and constraint topological consistency of the generated content.

[0472] General-purpose large models can only process textual semantic features and cannot perceive and utilize the structural information of constraint topology. This step transforms the constraint topology into a fusionable feature vector through a newly added graph encoding module and a dual projection layer, achieving simultaneous two-dimensional constraints of semantics and constraints in the decoding hidden state. The specific process is as follows:

[0473] Independent extraction of two types of features

[0474] Semantic features: The evidence chain text is encoded using the native word embedding layer of the large model to obtain a text semantic feature vector, which represents the semantic content information of the evidence;

[0475] Constraint topology features: The newly added graph convolutional encoding module in this scheme takes the constraint topology subgraph corresponding to the evidence chain as input (constraint nodes as vertices and constraint relationships as edges), and outputs a global constraint topology feature vector after two layers of graph convolution operations, which represents the constraint structure information of the evidence.

[0476] Independent projection layer mapping

[0477] Two new linear projection layers with independent parameters are added: a semantic projection layer and a topological projection layer. The semantic feature vector is input into the semantic projection layer, and the constrained topological feature vector is input into the topological projection layer. These layers are mapped to a feature space with the same dimension as the hidden state during decoding in the large model, resulting in dimension-matched semantic projection features. With topological projection features The parameters of the two projection layers are jointly fine-tuned according to the business scenario and are not part of the native parameters of the large model.

[0478] Time-step feature fusion

[0479] At each time step of the large model's autoregressive decoding, a weighted fusion is performed on the original hidden state of the current step and the two types of projected features. The fusion formula is as follows:

[0480] ;

[0481] in, This represents the original hidden state during the t-th decoding step; , , To integrate the weighting coefficients, satisfy the following conditions: + + =1, and in this embodiment, the values ​​are 0.5, 0.3, and 0.2 respectively;

[0482] Enhance the hidden state with the constraints after fusion, and replace the original hidden state for token probability prediction in the current step.

[0483] This fusion operation allows the generation process to receive dual guidance from both semantic and constraint structure information, thus avoiding the problem of semantic coherence but deviation from the constraint framework.

[0484] Step 73: External constraint verifier and generation of dynamic closed-loop control

[0485] At each step of the large model's autoregressive generation, an external constraint field validator verifies the values ​​of the constraint fields corresponding to the generated content in real time. If a deviation is detected in the core constraint layer fields, the process reverts to the position of the last token that meets the constraint, adjusts the token sampling probability distribution of the current step, and forces the generation of content that meets the constraint rules, thus achieving a dynamic constraint closed loop in the generation process.

[0486] The general-purpose large model is generated natively only through autoregression based on probability distribution, lacking the ability to verify constraint compliance, rollback, and probability correction during the generation process. Whether the generated content conforms to constraints depends entirely on prompts, making it impossible to guarantee that rigid constraints will not be violated. This step constructs a closed-loop mechanism of generation-verification-correction through a newly added external verification and control module. The specific process is as follows:

[0487] Token-by-token constraint verification

[0488] Deploy a constraint field validator independent of the large model. After each token is generated, extract the constraint field entity and value from the generated text and compare and verify them with the field rules of the core constraint layer: perform standardization and precise matching verification for enumerated, numeric, and time fields, and perform semantic equivalence verification for text fields.

[0489] If all core constraint field values ​​conform to the rules, the system is deemed compliant and the next token is generated. If any core constraint field is detected to deviate from the rules, the system is deemed to be in violation of the constraints and the correction process is triggered.

[0490] Constraint deviation correction execution:

[0491] After the correction is triggered, three steps will be executed in sequence:

[0492] First, decode state rollback: retrieve the large model decoding cache, roll back the decoding state to the last token position where all core constraints are compliant, restore the hidden state, KV cache and sampling context corresponding to that position, and discard all subsequent non-compliant generated content.

[0493] Second, sampling probability correction: constrain and correct the original token probability distribution of the current step, set the sampling probability of all candidate tokens that would cause the core constraints to continue to deviate to 0, and normalize the probability of the remaining legal candidate tokens so that the total probability sum is 1.

[0494] Third, constraint compliance resampling: the current step token is generated based on the corrected probability distribution sampling, ensuring that the generated content returns to the scope of the constraint rules.

[0495] Hierarchical flexible adaptation:

[0496] For deviations between fields in the supporting constraint layer and the auxiliary constraint layer, no forced state rollback is performed. Instead, the weight of the violating token is reduced in the sampling probability distribution, with the reduction magnitude in the supporting layer being greater than that in the auxiliary layer. This ensures both the smoothness and flexibility of the generation process while guaranteeing the rigid execution of the core constraints.

[0497] In this embodiment, the specific method for real-time verification of the constraint field values ​​corresponding to the generated content is as follows:

[0498] Based on the set of constraint semantic units generated in step 1, a thesaurus and expression variants are pre-built for each constraint semantic unit; during verification, a dual approach of string exact matching and semantic similarity matching is used:

[0499] Enumerated, numeric, and time fields: values ​​are extracted by matching keywords with regular expressions, and then compared accurately with the constrained values ​​after standardization.

[0500] Text-type fields: The corresponding expression is extracted by semantic similarity calculation. If the similarity is higher than 0.8, it is determined to match the constraint field. Then, the value is compared to see if it is compliant.

[0501] The verification process requires core constraint layer fields to be checked, while support and auxiliary layer fields are optional, consistent with the hierarchical constraint execution rules.

[0502] Step 74: Answer Information Encapsulation and Source Tracing Output

[0503] After completing the full sequence decoding and generation, output the response information that matches the hierarchical requirements of the constraints.

[0504] The decoding process terminates when the large model generates an end marker or reaches the preset maximum generation length, and the generated result is then encapsulated and output. The final output response information consists of two parts:

[0505] Main response text: Semantically coherent and accurately expressed natural language response content that strictly meets all the constraints of the core constraint layer, takes into account the matching requirements of the supporting constraint layer, and refers to the optimization direction of the auxiliary constraint layer.

[0506] Evidence tracing and annotation: Citation markers corresponding to each segment of the answer text, marking the evidence chain number, source fragment number, source knowledge base identifier, and fidelity level for each segment; users can trace back to the original evidence fragments in the answer evidence package through annotations, view the complete constraint matching situation and source information, and meet the requirements of interpretability and auditability.

[0507] This completes the closed-loop propagation of field constraints throughout their entire lifecycle, from query input, multi-database adaptation, retrieval recall, evidence fusion to answer generation, achieving lossless transmission and rigid control of constraint information throughout the entire process.

[0508] In this embodiment, this application may use a Decoder-only architecture general large language model with cross-attention mechanism as the base model, such as open source large models like Llama 3, Qwen 2, and InternLM, or closed source large models with equivalent capabilities.

[0509] The base model natively includes a word embedding layer, a multi-layer Transformer decoder, a cross-attention computation unit, a language model output head, and a KV caching mechanism, which can independently complete basic autoregressive text generation tasks. Its original structure remains unchanged. This application achieves this by adding external modules and computation links. The added modules are connected to the base model through standard input / output interfaces.

[0510] Four new functional modules have been added to the base model, which together constitute a constraint-aware generation model that supports the full-link propagation of field constraints. The complete new structure is as follows:

[0511] Constrained topology coding module:

[0512] The input-side parallel independent encoding branch is used to transform the structured constraint topology into feature vectors that the model can process. It is a structured information encoding unit that the base model does not have natively.

[0513] The constrained topology coding module consists of a 2-layer graph convolutional network (GCN) and a global average pooling layer connected in series. The graph convolutional network propagates features with constraint nodes as graph vertices and constraint relationships as graph edges. The pooling layer aggregates node-level features into global topology features.

[0514] In this embodiment, the initial feature vector of each constraint node corresponds to the semantic encoding vector of the corresponding constraint semantic unit, which is consistent with the output of the pre-trained semantic encoding model used in step 23, and the dimension is the output dimension of the pre-trained model; the attribute features of the edge are the type encoding and edge weight of the corresponding constraint relationship.

[0515] The graph convolutional network uses two GCN layers. The first layer aggregates the features of the node's neighborhood, and the second layer outputs global node-level features. After global average pooling, a fixed-dimensional global constrained topological feature vector is obtained.

[0516] The input to the constraint topology coding module is the constraint topology subgraph corresponding to each evidence chain in the answer evidence package, which includes the set of constraint nodes, node attributes, and the set of constraint edges and edge attributes.

[0517] The output of the constraint topology encoding module is a fixed-dimensional global constraint topology feature vector, with the same dimension as the hidden layer dimension of the base model decoder.

[0518] The constrained topology coding module runs independently of the text input branch and in parallel. The output features are connected to the subsequent dual-space feature projection module without altering the text input link of the base model.

[0519] 2. Dual-spatial feature projection module:

[0520] The hidden layer feature alignment and fusion unit is used to achieve co-space mapping between semantic features and constraint topological features. It is a bimodal feature fusion unit that is not natively available in the base model.

[0521] The dual-spatial feature projection module contains two linear projection layers with independent parameters: a semantic projection layer and a topological projection layer. The two projection layers can be jointly fine-tuned according to business data.

[0522] The inputs to the dual-spatial feature projection module include:

[0523] Semantic projection layer input: Evidence text semantic features output from the native word embedding layer of the base model;

[0524] Input to the topology projection layer: Global constraint topology features output by the constraint topology encoding module.

[0525] The output of the dual-space feature projection module is semantic projection features and topological projection features whose dimensions are completely consistent with the hidden state of the base model decoder.

[0526] The dual-spatial feature projection module is set in the hidden state calculation stage of each time step of the decoder. It performs weighted fusion of the two types of projected features with the original hidden state, replaces the original hidden state with the fused hidden state, and inputs it into the subsequent feedforward network and output head to realize constraint injection at the feature level.

[0527] 3. Structured attention mask generation module:

[0528] The cross-attention pre-control unit is used to guide the attention allocation weights of the decoder in a directional manner. It is a hierarchical attention control unit that is not natively present in the base model.

[0529] The dual-space feature projection module consists of three parts: a hierarchical labeling subunit, a mask numerical calculation subunit, and a mask matrix generation subunit.

[0530] The inputs to the dual-spatial feature projection module are the evidence token sequence position index, the highest constraint level associated with each token, and the topological integrity fidelity score of the corresponding evidence chain.

[0531] The output dimension of the dual spatial feature projection module is a structured attention mask matrix with dimensions of [maximum number of decoding steps, total number of evidence tokens] and the matrix elements have values ​​in the range of [0,1].

[0532] The access method of the dual-space feature projection module is as follows: In the cross-attention calculation stage of the base model decoder, after the original attention weight is calculated, the weight matrix is ​​multiplied element by element with the mask matrix to obtain the final attention weight after constraint correction, and then the weighted summation of the value vector is performed; only the attention weight values ​​are modified, without changing the original calculation logic of the cross-attention of the base model.

[0533] 4. Dynamic constraint verification and decoding control module:

[0534] The output-side external closed-loop control unit, independent of the computational graph of the base model, is used to perform constraint compliance verification and forced correction during the generation process. It is a generation control unit that the base model does not have at all.

[0535] The internal structure of the dual-spatial feature projection module consists of four sub-units:

[0536] Constraint field extraction subunit: Based on named entity recognition and rule matching, extract the values ​​of each constraint field from the generated text;

[0537] Constraint compliance verification subunit: Performs comparison and verification of field values ​​with the original constraint rules according to the constraint level, and outputs the compliance judgment result;

[0538] Decoding State Rollback Subunit: Calls the KV cache interface of the base model to roll back the decoding state to the specified historical token position and restore the corresponding context;

[0539] Sampling probability correction subunit: Masks the token probability distribution output by the original output header, sets the probability of illegal tokens to zero, and renormalizes it.

[0540] The inputs to the dual-space feature projection module are the token text output by the base model at each step, the set of field rules in the core constraint layer, the decoder KV cache, and the state data.

[0541] The output of the dual-space feature projection module is the constraint compliance judgment result, the corrected token sampling probability distribution, and the decoding state rollback instruction.

[0542] The dual-spatial feature projection module is mounted on the decoder output as an external controller. Each time a token is generated, a verification is triggered. If the verification passes, the native generation process continues. If the verification fails, a state rollback and probability correction instruction is sent to the base model to force the generation of compliant content, forming a closed-loop control of generation-verification-correction.

[0543] The newly added modules, in conjunction with the base model, will complete the constraint enhancement generation according to the following time sequence:

[0544] Input phase: Evidence text is input into the base model to obtain semantic features, and constraint topology subgraph is input into the constraint topology encoding module to obtain topological features. The two types of features are aligned in dimension by the dual spatial projection module. At the same time, the structured attention mask generation module outputs the mask matrix, which is preloaded into the cross attention unit.

[0545] Decoding phase: In each decoding step, the cross-attention distribution is first corrected by structured attention mask, and then the hidden state of the decoder is corrected by dual spatial feature fusion, and the token probability distribution is output.

[0546] Verification phase: The dynamic constraint verification and decoding control module verifies the generated results token by token; if the core constraint is violated, a rollback correction is triggered, and if the non-core constraint is violated, the execution probability is reduced, and the final output is a response text that fully meets the constraint classification requirements.

[0547] This application has the following advantages:

[0548] Existing technologies generally treat field constraints as one-time filtering parameters in the retrieval stage, which only take effect at a single point in the recall stage and cannot be continuously passed to subsequent stages such as candidate fusion, answer generation, and citation auditing. The system cannot track the execution status of constraints in multi-path recall and multi-node processing, nor can it explain the correspondence between the final answer and the original constraints, and the compliance of the constraints cannot be backtracked and verified.

[0549] This application constructs a unified field constraint topology graph as a standardized constraint carrier, and uses this structured constraint object throughout the entire process of query parsing, multi-database capability matching, retrieval recall, evidence fusion, and answer generation. Each step is processed and updated based on the same constraint object, and the execution, decay, and correction of constraints are traceable throughout the entire process. This completely changes the existing technology's single-point constraint processing mode and realizes closed-loop management of field constraints from input to output throughout their entire lifecycle.

[0550] Different knowledge bases have inherent differences in field naming, data types, index structures, and retrieval capabilities. Existing solutions rely on manual writing of filtering rules for each knowledge base, which cannot automatically assess the knowledge base's ability to support specific constraints. This can easily lead to problems such as unsuitable filtering expressions, mismatched field types, and the incorrect exclusion of valid knowledge bases, resulting in extremely high costs for multi-database expansion.

[0551] This application establishes a three-dimensional field capability tensor system, constructing standardized field capability profiles for each heterogeneous knowledge base from four dimensions: precise field matching, semantic mapping, topology preservation, and relation restoration. Through cross-database semantic alignment and neighborhood topology overlap correction, it calculates the multi-dimensional capability scores of each constraint field in each knowledge base, and finally constructs a row-column-channel three-dimensional field capability tensor. Based on this, it automatically judges the constraint adaptability of each knowledge base without the need for manual configuration of filtering rules for each knowledge base, realizing the standardized quantification and automatic adaptation of the constraint capabilities of heterogeneous knowledge bases.

[0552] The fusion of traditional vector retrieval and full-text retrieval only focuses on the semantic relevance of the text and the matching degree of keywords, without incorporating the consistency of field constraints into the evaluation system. When candidate fragments are highly semantically relevant but do not meet field constraints (such as unpublished document status, incorrect permission scope, or expired version), they may still be ranked at the top of the results, ultimately leading to the answer referencing non-compliant or invalid materials.

[0553] This application proposes a technical solution combining constraint hierarchy and dual-space retrieval architecture. Based on topological importance, constraints are divided into three levels: core, support, and auxiliary, corresponding to different execution intensities and fault tolerance standards. At the same time, the traditional single retrieval space is split into two independent branches: semantic retrieval and constraint retrieval. Differentiated dual-space fusion rules are configured for different constraint levels: core constraints use pre-processing hard filtering to ensure absolute compliance, support constraints use weighted fusion to balance accuracy and recall, and auxiliary constraints use post-processing verification to optimize ranking. Under the premise of ensuring strict execution of rigid constraints, the effective recall results are maximized.

[0554] Existing search-enhanced question-answering systems can only return fragmented quoted text snippets, failing to fully present process information such as how constraints are generated, in which stages they take effect, which candidates are filtered, the differences in output from different search channels, and the influencing factors of fusion ranking. For scenarios requiring explainability and auditability, such as government and corporate regulations, the system's credibility and compliance cannot be supported.

[0555] This application uses the original constraint topology as the skeleton to combine discrete candidate fragments into a structured candidate evidence chain; it resolves conflicts of multi-source evidence through a manifold alignment algorithm, and after multi-dimensional scoring and screening based on topological completeness, semantic coherence, and source credibility, it is packaged into a standardized answer evidence package; the evidence package fully records the constraint matching status, source information, and fidelity level of each piece of evidence, supports reverse tracing from the final answer to the retrieval and fusion of the processing of each node, and meets the auditability requirements of high compliance scenarios.

[0556] Existing solutions mainly guide large models to comply with field constraints through prompts, which are soft constraints. They rely on the model's own ability to follow instructions and cannot guarantee that core constraints will not be broken through the mechanism. Large models can easily generate illusions that lead to field value deviations and constraint failures. Moreover, the generation process lacks real-time verification and correction capabilities, and cannot automatically repair constraints once deviations occur.

[0557] This application achieves rigid control over the generation process through a three-layer constraint injection mechanism without modifying the original structure of the base model: at the attention layer, the model is guided to focus on the core constraint evidence through a structured attention mask; at the feature layer, constraint topology information is injected into the decoding hidden state through dual-space feature fusion; at the output layer, the constraint compliance is verified token by token through an external verification module, and state rollback and probability correction are performed for deviations. The three-layer mechanism together form a dynamic closed loop of "generation-verification-correction", upgrading the soft constraints of prompt words to a mechanism-based hard constraint, fundamentally ensuring that the core constraints are not broken.

[0558] The following examples further illustrate this application in detail. It is understood that these examples do not constitute any limitation on this application.

[0559] Example 1: Question and Answer Scenario of Government Service Knowledge Base

[0560] In this scenario, the system integrates four heterogeneous knowledge bases: a street-level business knowledge base, a public service knowledge base, a security risk control knowledge base, and a historical Q&A knowledge base. Each base has different field definitions and is applicable to different business scopes. The user query is: "How do I apply for newborn medical insurance in Huoying Street? Is there a phone number and processing location?"

[0561] Step 1: Obtain user query information

[0562] Extract explicit text layer information: The semantic unit of the query subject is "newborn medical insurance application"; the explicit qualifying field is "Huoying Street"; the explicit logical predicate is a parallel relationship; the query task type is fact query + process query.

[0563] Generate implicit constraint layer information: Domain ontology constraints are limited by default to "the scope of government services in Changping District, Beijing, and the scope of basic medical insurance for employees"; intent priority constraints are "processing procedure > processing location > contact number"; semantic boundary constraints exclude content related to adult medical insurance, employee medical insurance, and medical insurance in other places.

[0564] The current dialogue is a single turn with no historical context, and the session context layer information is empty.

[0565] Users only perform text attachment and front-end filtering operations, and the modal auxiliary layer information is empty.

[0566] Semantic alignment, deduplication and fusion, and attribute annotation are performed on the four layers of information to generate a set containing five constraint semantic units: "Newborn Medical Insurance Application, Huoying Street, Application Process, Application Location, and Contact Number". The data type, constraint type, and priority weight of each unit are annotated.

[0567] Extract the logical relationships between fields: "Huoying Street" has a limiting relationship with "Newborn Medical Insurance Application", and "Application Process, Application Location, Contact Number" has a subordinate relationship with "Newborn Medical Insurance Application", generating an initial semantic relationship set.

[0568] Step 2: Generate a 3D multi-knowledge base field capability tensor

[0569] A field constraint topology graph is constructed using 5 constraint semantic units as vertices and corresponding logical relationships as weighted directed edges. The source node is restarted with "Newborn Medical Insurance Application" as the core. The topological importance of each unit is obtained through constraint strength topological diffusion iteration calculation. The normalized inherent constraint strengths are as follows: Newborn Medical Insurance Application 0.95, Huoying Street 0.88, Application Process 0.72, Application Location 0.65, and Contact Number 0.51.

[0570] Capability profiles of pre-built fields retrieved from four heterogeneous knowledge bases: the street business knowledge base includes the fields region, service_type, and contact, with strong precise matching and topology preservation capabilities; the public service knowledge base includes the fields category and location, with strong semantic mapping capabilities; the security risk control knowledge base only includes the attack_type field, without support from government business fields; and the historical question-and-answer knowledge base includes the fields question, answer, and area, with weak relationship restoration capabilities.

[0571] Each constraint semantic unit is semantically aligned with the knowledge base field one by one, and the neighborhood topology overlap is corrected to obtain the four-dimensional capability score of each field in the corresponding knowledge base; for example, "Huoying Street" has a precise matching capability score of 0.92 in the street business knowledge base and a semantic mapping capability score of 0.58 in the public service knowledge base.

[0572] Using constrained semantic units as rows, knowledge bases as columns, and four capabilities as channels, a 5×4×4 three-dimensional multi-knowledge base field capability tensor is constructed.

[0573] Step 3: Perform constraint hierarchies on the 3D tensor to generate constraint hierarchy information.

[0574] Calculate the coefficients of each vertex joint, identify "Newborn Medical Insurance Application" and "Huoying Street" as topological joints, and assign them to the core constraint layer; "Application Process" and "Application Location" are ordinary connection nodes, and assign them to the support constraint layer; "Contact Number" is a suspended node, and assign it to the auxiliary constraint layer.

[0575] Based on the three-dimensional tensor fitting of the constraint strength-recall phase transition curve of each knowledge base corresponding to the three layers of constraints, the step critical point is extracted as the constraint tolerance threshold; for example, the tolerance threshold of the core layer of the street business knowledge base is 2.0, the tolerance threshold of the core layer of the public service knowledge base is 0.7, and the tolerance threshold of the core layer of the security risk control knowledge base is 0.

[0576] Configure layered execution rules: the core constraint layer adopts exact matching hard filtering rules, the supporting constraint layer adopts semantic weighted matching rules, and the auxiliary constraint layer adopts post-relevance verification rules; calculate the corresponding fault tolerance threshold based on the tolerance threshold of each library, for example, the fault tolerance threshold of the public service knowledge base support layer is 0.56.

[0577] By integrating the hierarchical division results, tolerance thresholds, and execution rules, structured constraint hierarchical information is generated.

[0578] Step 4: Generate an executable retrieval strategy

[0579] Calculate the constraint propagation loss coefficient of each knowledge base and determine the highest adaptation level: the street business knowledge base adapts to the core constraint layer, the public service knowledge base adapts to the supporting constraint layer, the historical question and answer knowledge base adapts to the auxiliary constraint layer, and the security risk control knowledge base does not adapt to business constraints and only performs independent prompt word injection security detection.

[0580] A dual-space retrieval architecture is constructed, in which semantic retrieval and constraint retrieval branches are independent of each other. The two branches independently complete similarity calculation and initial ranking.

[0581] Configure hierarchical fusion rules: the core layer adopts constraint branch hard filtering followed by semantic branch reordering, the support layer adopts dual-space score weighted fusion, and the auxiliary layer adopts semantic recall followed by constraint post-verification; the recall quantity and similarity threshold parameters of each layer are configured synchronously.

[0582] A dynamic programming path optimization algorithm is used to select the recall path combination with the minimum cumulative constraint loss, and then combined with corresponding fusion rules and parameters to generate a complete executable retrieval strategy.

[0583] Step 5: Perform multi-channel candidate recall and generate candidate answer fragments.

[0584] Based on the retrieval strategy, a dual-branch retrieval is initiated in parallel in each target knowledge base: the semantic branch performs dense recall based on vector similarity to generate a set of semantic candidate fragments; the constraint branch performs structured recall based on topological matching degree to generate a set of constraint candidate fragments.

[0585] Real-time calculation of cross-database topology drift: The public service knowledge base has no corresponding region field, the topology drift is 0.25, which exceeds the preset compensation threshold of 0.2. The constraint retrieval vector is corrected in the opposite direction of drift, supplementary recall is performed, and the constraint candidate fragment set is updated.

[0586] All returned results are subjected to cross-database deduplication and fragment granularity normalization. Each candidate fragment is labeled with four attributes: constraint matching field set, topological matching degree, semantic matching degree, and source knowledge base identifier, to generate a standardized candidate answer fragment set.

[0587] Step 6: Construct an answer evidence package based on candidate answer fragments

[0588] Using the field constraint topology graph as the skeleton, each candidate fragment is mapped to the constraint topology space, and 8 candidate evidence chains with matching topological structures are generated by filtering and combining them. All evidence chains completely cover the core constraint layer nodes.

[0589] Identify conflicting fragments: Different candidate fragments have different descriptions of the processing location. Calculate the manifold alignment degree of each conflicting fragment with the original topology, retain the official address fragment with a manifold alignment degree of 0.78, and remove the third-party unofficial information fragment with an alignment degree of 0.42 to complete the conflict resolution.

[0590] The evidence chains were ranked based on a comprehensive score of three indicators: topological completeness, semantic coherence, and source credibility. The top 5 evidence chains were selected, and each evidence chain was labeled with three fidelity information: field matching degree, topological completeness, and source credibility.

[0591] The evidence chain and fidelity information are layered and encapsulated to generate a structured response evidence package.

[0592] Step 7: Input the answer evidence package into the large model to generate answer information.

[0593] Extract the evidence chain and fidelity information, and transform the constraint topology into a structured attention mask for the decoding layer of the large model; set a forced attention mask for the token corresponding to the core constraint layer, and set a weighted attention mask for the token corresponding to the support layer.

[0594] Semantic features and constraint topological features of the evidence are extracted separately and mapped to the hidden feature space of the large model through independent projection layers. Dual-space feature fusion is performed at each step of decoding to simultaneously constrain semantic fluency and topological consistency.

[0595] During the generation process, the values ​​of core constraint fields are verified one by one for each token. If medical insurance information other than Huoying Street is detected in the generated content, the process immediately reverts to the position of the previous compliant token, adjusts the sampling probability distribution, and forces the generation of content that meets the constraints, thus forming a dynamic constraint closed loop.

[0596] Complete full sequence decoding and output the response text containing the processing procedure, official processing location, and contact number, along with evidence tracing annotations, allowing users to view the source fragments and constraint hit status.

[0597] Example 2: Corporate Policy Q&A Scenario

[0598] In this scenario, the system integrates four heterogeneous knowledge bases: a headquarters policy database, a research and development department database, a financial policy database, and a historical version document database. The naming and types of fields such as department and effective date differ across these databases. A user query would be: "What is the current reimbursement policy applicable to the research and development department?"

[0599] Step 1: Obtain user query information

[0600] Explicit text layer: The semantic unit of the query subject is "reimbursement system", the explicit qualifying fields are "R&D department, currently valid", and the query task type is fact query.

[0601] Implicit constraint layer: Domain ontology constraints are limited by default to "officially released company policies and currently valid versions", intent priority constraints are "policy validity > applicable departments > policy type", and semantic boundary constraints exclude personnel and administrative reimbursement policies and obsolete versions.

[0602] There are no multi-turn contexts or non-text inputs, and the other two layers of information are empty.

[0603] After alignment and fusion, a set of constrained semantic units is generated: "reimbursement system, R&D department, currently valid, officially released", and the limitations and subordinate relationships are extracted to generate an initial set of semantic relationships.

[0604] Step 2: Generate a 3D multi-knowledge base field capability tensor

[0605] Construct a field constraint topology graph, with "reimbursement system" as the core source node, and iteratively calculate the inherent constraint strength of each unit: reimbursement system 0.96, currently effective 0.90, R&D department 0.82, officially released 0.71.

[0606] Capability profiles for retrieving fields from each database: The R&D database contains the fields dept, status, and effective_date, demonstrating strong precise matching capabilities; the headquarters policy database contains the fields org_scope and publish_state, exhibiting relatively strong semantic mapping capabilities; the financial policy database contains the fields dept_name and valid_period, with slight differences in type; the historical version document database only stores old files and lacks a valid status field.

[0607] Perform cross-database field semantic alignment and weighted calculation. For example, "R&D department" is mapped to three different fields: dept, org_scope, and dept_name. After correction based on the overlap of neighborhood topology, the capability scores for each dimension are obtained.

[0608] Construct a 4×4×4 three-dimensional multi-knowledge base field capability tensor.

[0609] Step 3: Constraint Hierarchy and Constraint Hierarchy Information Generation

[0610] Identify "Reimbursement System", "Currently Valid", and "R&D Department" as topological nodes and assign them to the core constraint layer; "Officially Released" is a regular connection node and assign it to the support constraint layer.

[0611] Fit the phase transition curve and calculate the constraint tolerance threshold for each library: the tolerance threshold for the core layer of the R&D section library is 2.5, the tolerance threshold for the core layer of the headquarters system library is 2.1, the tolerance threshold for the core layer of the financial system library is 1.8, and the tolerance threshold for the core layer of the historical version document library is 0.3.

[0612] Configuration rules: Core layer fields must match exactly; otherwise, they will be filtered out. Support layer fields will participate in weighted scoring. Fault tolerance thresholds for each database will be generated synchronously.

[0613] Integrate and generate constraint hierarchy information.

[0614] Step 4: Generate an executable retrieval strategy

[0615] Calculate the loss coefficient and determine the adaptation level: the R&D section library, the headquarters system library, and the financial system library are all adapted to the core constraint layer, while the historical version document library is only adapted to the auxiliary constraint layer and does not participate in the core filtering.

[0616] Build a dual-space retrieval architecture and configure hierarchical fusion rules and threshold parameters.

[0617] Path optimization determines the optimal recall combination, generates an executable retrieval strategy, and clarifies the filtering rules, recall quantity, and sorting method for each database.

[0618] Step 5: Multi-channel candidate recall generates candidate answer fragments

[0619] Parallel execution of dual-branch retrieval: the constraint branch performs pre-processing hard filtering on core constraint fields, directly eliminating all obsolete or non-R&D department-applicable policy fragments.

[0620] The field mapping topology drift of the financial system database was found to be 0.15, which is below the compensation threshold, and therefore compensation was not triggered.

[0621] Cross-database deduplication, granular normalization, and attribute annotation are performed to generate candidate answer fragments.

[0622] Step 6: Construct the answer evidence package

[0623] Candidate evidence chains are generated by combining constraint topology as the skeleton, ensuring that each evidence chain satisfies the core constraints.

[0624] For clauses with conflicting content in different libraries, calculate the manifold alignment, retain the latest published version of the clauses, and remove outdated version clauses.

[0625] After ranking the overall scores, the top 4 chains of evidence are selected and their fidelity information is marked.

[0626] Encapsulate and generate a structured answer evidence package.

[0627] Step 7: Large model generates answer information

[0628] Inject a structured attention mask to force the model to focus on the evidence content corresponding to the core constraints.

[0629] Dual-spatial feature fusion decoding ensures semantic fluency and constraint consistency simultaneously.

[0630] Dynamically validate core constraints; if the generated content references policies not issued by R&D departments or that have been abolished, immediately revert and correct it.

[0631] The final response should clearly state the current reimbursement policy terms applicable to the R&D department, and include source documents, version numbers, effective dates, and other traceability information for each term.

[0632] Although the present invention has been described in detail above with general description and specific embodiments, modifications or improvements can be made to it, which will be obvious to those skilled in the art. Therefore, all such modifications or improvements made without departing from the spirit of the present invention are within the scope of protection claimed by the present invention.

Claims

1. A dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering method, characterized in that, The dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering method includes: Step 1: Obtain user query information; Step 2: Generate a three-dimensional multi-knowledge base field capability tensor based on the user query information; Step 3: Perform constraint hierarchies on the three-dimensional multi-knowledge base field capability tensor to generate constraint hierarchical information; Step 4: Generate an executable retrieval strategy based on the multi-knowledge base field capability matrix and constraint hierarchy information; Step 5: Perform multi-path candidate recall based on the executable retrieval strategy to generate candidate answer fragments; Step 6: Construct an answer evidence package based on candidate answer fragments; Step 7: Input the answer evidence package into the preset large model to generate answer information.

2. The dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering method as described in claim 1, characterized in that, The acquisition of user query information includes: Step 11: Obtain explicit text layer information directly input by the user, including query subject semantic units, explicit qualifying fields, explicit logical predicates, and query task type; Step 12: Generate implicit constraint layer information based on explicit text layer information, wherein the implicit constraint layer information includes domain ontology constraints, intent priority constraints, and semantic boundary constraints. Step 13: In a multi-turn dialogue scenario, extract the session context layer information from the historical session interaction records. The session context layer information includes constraint inheritance fields, constraint modification fields, and session topic domain constraints. Step 14: Parse the non-text modal data input by the user to extract modal auxiliary layer information, which includes attachment structured fields, cross-modal transcription fields, and front-end interaction constraint parameters; Step 15: Perform semantic alignment, deduplication and fusion, and attribute annotation on the explicit text layer information, implicit constraint layer information, conversation context layer information, and modal auxiliary layer information to generate a set of constraint semantic units with attribute annotations; Step 16: Extract the logical dependencies and constraints between the fields in the explicit text layer information, implicit constraint layer information, session context layer information, and modal auxiliary layer information to generate an initial semantic relationship set; the user query information includes the constraint semantic unit set and the initial semantic relationship set.

3. The dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering method as described in claim 2, characterized in that, Step 2 includes: Step 21: Extract the set of constraint semantic units and the set of initial semantic relations from the user query information. Construct a field constraint topology graph with constraint semantic units as vertices and logical dependencies and limiting relations in the set of initial semantic relations as weighted edges. Calculate the topological importance of each constraint semantic unit in the topology graph as the quantification value of the inherent constraint strength of the field. Step 22: For each accessed heterogeneous knowledge base, retrieve the pre-built field capability profile. The field capability profile includes four capability dimension attributes: field accurate matching capability, semantic mapping capability, topology preservation capability, and relationship restoration capability, which correspond to single field value matching accuracy, single field semantic adaptability, constraint overall structure maintenance capability, and logical relationship restoration capability between fields, respectively. Step 23: Perform semantic alignment mapping on each field in the constraint semantic unit set and the corresponding field capability profile of the heterogeneous knowledge base one by one, and perform weighted calculation based on the topological importance of the corresponding field to obtain the capability score of each query field in each dimension under the corresponding heterogeneous knowledge base. Step 24: Construct a three-dimensional multi-knowledge base field capability tensor with constraint semantic units as the row dimension, each accessed heterogeneous knowledge base as the column dimension, and the four capability dimensions as the channel dimension.

4. The dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering method as described in claim 3, characterized in that, Step 3 includes: Step 31: Based on the topological structure of the field constraint topology graph and the topological importance of each constraint semantic unit, identify topological key points, ordinary connection nodes and dangling nodes, and divide the corresponding constraint semantic units into core constraint layer, support constraint layer and auxiliary constraint layer to obtain the field constraint hierarchy division result; wherein the topological key point is the node whose number of connected components in the topology graph increases after removal, and corresponds to the constraint semantic units of a preset proportion before the topological importance sorting. Step 32: Based on the three-dimensional multi-knowledge base field capability tensor, fit the constraint strength-recall phase transition curve of each constraint level corresponding to each heterogeneous knowledge base, calculate the step critical point of each curve as the constraint tolerance threshold of the corresponding knowledge base, and determine the executable boundary of each heterogeneous knowledge base for different levels of constraints. Step 33: Combining the field constraint hierarchy division results with the constraint tolerance thresholds of each heterogeneous knowledge base, configure cross-database unified constraint execution rules and single-database adapted fault tolerance thresholds for each constraint hierarchy; among which, the core constraint layer is configured with exact matching hard filtering rules, the support constraint layer is configured with semantic weighted matching rules, and the auxiliary constraint layer is configured with post-relevance verification rules. Step 34: Integrate the field constraint hierarchy division results, the constraint tolerance thresholds of each knowledge base, and the constraint execution rules of each level to generate constraint classification information.

5. The dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering method as described in claim 4, characterized in that, Step 4 includes: Step 41: Extract the dimensional capability scores of each heterogeneous knowledge base from the three-dimensional multi-knowledge base field capability tensor, combine the field constraint level division results in the constraint grading information with the constraint tolerance threshold of each knowledge base, calculate the constraint propagation loss coefficient of each heterogeneous knowledge base under the core constraint layer, support constraint layer and auxiliary constraint layer, and determine the highest constraint execution level that each knowledge base can adapt to. Step 42: Based on the constraint execution rules of each constraint level in the constraint hierarchy information, construct a dual-space retrieval architecture in which the semantic retrieval branch and the constraint retrieval branch are independent of each other; wherein the semantic retrieval branch is used to perform pure semantic similarity recall, and the constraint retrieval branch is used to perform constraint topology matching recall, and the two branches independently complete similarity calculation and initial ranking. Step 43: Configure differentiated dual-space fusion rules and recall control parameters for the core constraint layer, supporting constraint layer, and auxiliary constraint layer respectively: the core constraint layer adopts a fusion rule of hard filtering of constraint branches followed by semantic branch reordering, the supporting constraint layer adopts a fusion rule of weighted calculation of dual-space scores, and the auxiliary constraint layer adopts a fusion rule of post-validation of constraint branches after semantic branch recall; at the same time, configure corresponding recall quantity and similarity threshold parameters for each constraint layer; Step 44: Based on the constraint propagation loss coefficient of each knowledge base, a path optimization algorithm is used to select the multi-path recall path combination with the minimum constraint cumulative loss. This is combined with the fusion rules and recall control parameters of the corresponding constraint level to generate an executable retrieval strategy that includes recall paths, retrieval operators, sorting rules, and threshold parameters.

6. The dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering method as described in claim 5, characterized in that, Step 5 includes: Step 51: Based on the multi-path recall path, dual-space fusion rules and threshold parameters determined by the executable retrieval strategy, initiate the semantic retrieval branch and the constraint retrieval branch in parallel in each target heterogeneous knowledge base; the semantic retrieval branch performs dense recall based on pure semantic vector similarity to generate a set of semantic candidate fragments; the constraint retrieval branch performs structured recall based on constraint topology matching degree to generate a set of constraint candidate fragments. Step 52: For the recall paths corresponding to the core constraint layer and the supporting constraint layer, calculate the topology drift amount after the field constraint topology is mapped across the knowledge base in real time; if the topology drift amount exceeds the preset compensation threshold, correct the retrieval vector of the constraint retrieval branch in the opposite direction of drift, perform supplementary recall after drift compensation, and update the constraint candidate fragment set. Step 53: Perform cross-database deduplication and fragment granularity normalization on all semantic candidate fragment sets and constraint candidate fragment sets returned by the knowledge base, and label each candidate fragment with four attributes: constraint matching field set, topological matching degree, semantic matching degree, and source knowledge base identifier, to generate candidate answer fragments labeled with constraint attributes.

7. The dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering method as described in claim 6, characterized in that, Step 6 includes: Step 61: Using the field constraint topology graph as the skeleton structure, map each candidate answer fragment to the constraint topology space, filter fragments that cover the corresponding constraint level nodes and topological relationships, and combine them to generate multiple candidate evidence chains with matching topological structures. Step 62: Identify candidate segments in different candidate evidence chains that have conflicting field values ​​or logical relationships, calculate the manifold alignment degree between each conflicting segment and the original field constraint topology graph, retain conflicting segments with manifold alignment degree higher than a preset threshold, and remove segments with low alignment degree to complete the conflict resolution of multi-source evidence. Step 63: For the candidate evidence chains that have completed conflict resolution, perform a comprehensive scoring and ranking according to the three indicators of topological completeness, semantic coherence and source credibility, select the top-ranked preset number of evidence chains, and label each evidence chain with field matching degree, topological completeness and source credibility fidelity information. Step 64: Integrate and encapsulate all the selected candidate evidence chains with their corresponding fidelity annotation information to generate a structured answer evidence package.

8. The dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering method as described in claim 7, characterized in that, Step 7 includes: Step 71: Extract each evidence chain and its corresponding fidelity labeling information from the answer evidence package, and transform the constraint topology corresponding to the evidence chain into a structured attention mask for the large model decoding layer; wherein a forced attention mask is set at the evidence token position corresponding to the core constraint layer, and a weighted attention mask is set at the evidence token position corresponding to the support constraint layer, which is used to limit the attention allocation range and weight in the large model decoding process; Step 72: Extract the semantic features and constraint topology features of each evidence chain respectively, and map them to the hidden feature space of the preset large model through independent projection layers. Perform dual-space feature fusion at each step of decoding to simultaneously constrain the semantic fluency and constraint topology consistency of the generated content. Step 73: In each step of the large model autoregressive generation, the values ​​of the constraint fields corresponding to the generated content are verified in real time; if a deviation is detected in the core constraint layer field, the process is reversed to the position of the last token that meets the constraint, the token sampling probability distribution of the current step is adjusted, and content that meets the constraint rules is forcibly generated, thus realizing a dynamic constraint closed loop in the generation process. Step 74: After completing the full sequence decoding and generation, output the answer information that matches the hierarchical requirements of the constraint.

9. The dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering method as described in claim 8, characterized in that, Step 21 includes: Step 211: Using each constraint semantic unit in the constraint semantic unit set as a vertex, and the logical dependencies, constraints, subordination, and mutual exclusion relationships in the initial semantic relationship set as directed edges with attributes, construct the initial directed field constraint topology graph. Step 212: Based on the logical relation types in the initial semantic relation set, assign corresponding edge weights to each directed edge, where the edge weights of limiting relations are greater than those of subordinate relations, and the edge weights of mutually exclusive relations are negative. Step 213: Using the core semantic unit corresponding to the query task type as the personalized restart node, calculate the steady-state access probability of each vertex, and use the steady-state access probability as the topological importance of the corresponding constraint semantic unit; Step 214: Normalize the topological importance of each constraint semantic unit to the [0,1] interval to obtain the quantized value of the inherent constraint strength of the field.

10. A dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering device, characterized in that, The dynamic field constraint propagation multi-knowledge base hybrid retrieval enhanced question answering device includes: User query information acquisition module, the user query information acquisition module is used to acquire user query information; A three-dimensional multi-knowledge base field capability tensor acquisition module is used to generate a three-dimensional multi-knowledge base field capability tensor based on user query information. The constraint grading information acquisition module is used to perform constraint grading on the three-dimensional multi-knowledge base field capability tensor, thereby generating constraint grading information. An executable retrieval strategy acquisition module is used to generate an executable retrieval strategy based on a multi-knowledge base field capability matrix and constraint hierarchical information. A candidate answer fragment acquisition module is used to perform multi-way candidate recall according to an executable retrieval strategy, thereby generating candidate answer fragments; The answer evidence package acquisition module is used to construct an answer evidence package based on candidate answer fragments. The response information acquisition module is used to input the response evidence package into a preset large model to generate response information.