Semantic enhancement processing system based on large model agent rag database

By using semantic query parsing, conflict identification, and dynamic trade-off factor construction, the RAG system generates counterfactual reasoning results that balance creativity and factual basis, solving the problem of fixed strategies in existing systems when dealing with counterfactual assumptions, and achieving high-quality reasoning results and adaptive optimization.

CN121072782BActive Publication Date: 2026-05-12SHAANXI AEROSPACE LANXI TECH DEV CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHAANXI AEROSPACE LANXI TECH DEV CO LTD
Filing Date
2025-10-20
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Existing RAG systems cannot dynamically adjust the trade-off factors when faced with counterfactual assumptions, resulting in consistent reasoning strategies when dealing with different semantic conflict intensities. This makes it difficult to generate answers that are both creative and based on reasonable facts, especially in fields such as education, creative writing, and scientific exploration.

Method used

The semantic query parsing module obtains user input, the knowledge retrieval and conflict identification module identifies conflicting fact subsets, the semantic reconstruction module constructs dynamic trade-off factors, the multi-layer semantic alignment network generates enhanced knowledge fragments, and the reasoning result generation module outputs reasoning results that balance creativity and factual basis.

Benefits of technology

The system can intelligently adjust its reasoning strategy based on the nature and degree of conflict of counterfactual assumptions, generate high-quality counterfactual reasoning results, maintain a balance between creativity and factual basis, adapt to the counterfactual reasoning needs of different fields, and has adaptive optimization characteristics and high interpretability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121072782B_ABST
    Figure CN121072782B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of artificial intelligence, and discloses a semantic enhancement processing system based on a large model intelligent agent RAG database; aims to solve the balance problem of creative thinking and fact basis retrieval in counterfactual reasoning. Through a semantic query analysis module, the counterfactual hypothesis conditions of the user are obtained, the knowledge retrieval and conflict identification module is used to accurately quantify the semantic conflict intensity, and a dynamic weighting factor is constructed to control the balance ratio of creativity and factuality. A multi-layer semantic alignment network is introduced to reconstruct the semantic of the fact knowledge, generate an enhanced knowledge fragment set compatible with the counterfactual hypothesis, and construct a reliable counterfactual reasoning path. At the same time, a feedback optimization mechanism is also provided, which can continuously learn and improve from user interaction, and realize the adaptive adjustment of parameters. The application improves the reasoning quality of the large model, and generates high-quality content that meets the counterfactual premise and maintains basic reasonableness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and more specifically, to a semantic enhancement processing system based on the RAG database of large model intelligent agents. Background Technology

[0002] With the rapid development of large language model (LLM) technology, retrieval-enhanced generative (RAG)-based intelligent agent systems have become an important research direction in the field of artificial intelligence. RAG technology effectively compensates for the shortcomings of large models in terms of knowledge timeliness and domain-specific accuracy by combining external knowledge base retrieval with generative models. In current technical practice, RAG systems mainly use vector databases to store knowledge fragments, retrieve information relevant to user queries through semantic similarity, and then integrate this information with a large model to generate answers. It has been widely applied in scenarios such as intelligent question answering, decision support, and content creation.

[0003] However, RAG's agent system often faces a dilemma when encountering counterfactual assumptions that clearly conflict with known facts: if it relies too heavily on retrieved factual knowledge, the system stubbornly refuses to accept counterfactual premises, preventing in-depth reasoning. For example, in the query "assuming Newton never discovered universal gravitation," the system constantly reverts to historical facts, failing to conduct meaningful hypothetical exploration. If it completely ignores factual constraints, it generates unreasonable inferences that deviate from basic scientific principles, such as generating conclusions that violate basic biological principles in the assumption "assuming humans can photosynthesize." This simplistic either-or approach prevents the system from dynamically adjusting trade-off factors based on the specific intensity and type of semantic conflict, particularly in fields like education, creative writing, and scientific exploration, where it cannot provide answers that are both creative and grounded in sound facts. Existing systems lack the ability to accurately quantify the degree of conflict between counterfactual assumptions and factual knowledge, failing to distinguish between slight deviations and fundamental subversions. This leads to the use of the same processing strategy under different conflict intensities; for example, the system exhibits the same confusion when dealing with assumptions with significantly different levels of conflict, such as "assuming the internet appeared ten years later" and "assuming electricity cannot be conducted." Furthermore, existing technologies generally employ coarse-grained keyword matching or simple vector similarity calculations in the process of semantic conflict identification, which cannot capture complex semantic dependencies and implicit conflicts. As a result, in fields where the accuracy of facts is highly critical, such as medical diagnostic assistance, legal consultation, and policy analysis, the system cannot guarantee the basic reliability of the generated content.

[0004] In view of this, the present invention proposes a semantic enhancement processing system based on the RAG database of large model intelligent agents to solve the above problems. Summary of the Invention

[0005] To overcome the aforementioned shortcomings of the prior art and to achieve the above objectives, the present invention provides the following technical solution: a semantic enhancement processing system based on the large model agent RAG database, comprising:

[0006] The semantic query parsing module is used to obtain the semantic query request input by the user. The semantic query request includes the target reasoning task description and counterfactual assumptions.

[0007] The knowledge retrieval and conflict identification module is used to retrieve a set of factual knowledge fragments related to the description of the target reasoning task from the RAG database based on semantic query requests, and extract a subset of binding facts that conflict with counterfactual assumptions from the set of factual knowledge fragments.

[0008] The semantic reconstruction module is used to construct a dynamic trade-off factor based on the semantic conflict intensity of the constraint fact subset. The dynamic trade-off factor is used to characterize the relative weight of creative thinking generation and factual evidence retrieval.

[0009] A multi-layer semantic alignment network is used to semantically reconstruct a set of factual knowledge fragments using dynamic trade-off factors, generating an enhanced set of knowledge fragments that is compatible with counterfactual assumptions.

[0010] Based on the enhanced knowledge fragment set, the semantics of the target reasoning task description are semantically extended through a multi-layer semantic alignment network to generate an enhanced semantic representation containing counterfactual reasoning paths;

[0011] The reasoning result generation module is used to output semantically enhanced reasoning results that satisfy the balance between creative thinking and factual basis, based on the enhanced semantic representation and the constraints of dynamic trade-off factors.

[0012] Preferably, a set of factual knowledge fragments related to the description of the target reasoning task is retrieved from the RAG database, and a subset of binding facts that conflict with counterfactual assumptions is extracted from the set of factual knowledge fragments, including:

[0013] Dependency parsing is performed on the target reasoning task description to extract core predicate-argument pairs and generate semantic query vectors.

[0014] Based on semantic query vectors, multi-scale semantic similarity matching is performed in the RAG database to obtain a set of factual knowledge fragments whose semantic relevance to the core predicate-argument pairs exceeds a preset first threshold.

[0015] Logically decompose the counterfactual assumptions to generate a set of counterfactual predicates, and calculate the degree of predicate conflict between the counterfactual predicates and each factual knowledge fragment in the set of factual knowledge fragments;

[0016] Based on the degree of predicate conflict, identify factual knowledge fragments in the factual knowledge fragment set whose predicate conflict exceeds a preset second threshold and mark them as a subset of constrained facts;

[0017] Semantic clustering is performed on factual knowledge fragments in the constraint fact subset, and duplicate fact fragments with semantic redundancy exceeding a preset redundancy threshold are removed to generate a simplified constraint fact subset.

[0018] Preferably, a dynamic trade-off factor is constructed based on the semantic conflict strength of the constraint fact subset, including:

[0019] For each fact knowledge fragment in the constrained fact subset, calculate the angle between its semantic embedding vector and the counterfactual assumption, as the local semantic conflict strength;

[0020] Based on the intensity of local semantic conflict, conflict distribution entropy is introduced to calculate the semantic conflict uncertainty of the entire subset of binding facts.

[0021] Based on the semantic conflict uncertainty, a conflict intensity normalization function is constructed to map the semantic conflict uncertainty to the [0,1] interval and generate the conflict intensity normalization coefficient.

[0022] Using the conflict intensity normalization coefficient and the preset creative thinking priority parameters, a dynamic trade-off factor is calculated. The larger the value of the dynamic trade-off factor, the higher the weight of creative thinking.

[0023] The dynamic trade-off factor is corrected for time decay by introducing the contextual temporal features of semantic query requests to reduce the interference of historical conflicts on the current trade-off factor.

[0024] Preferably, a dynamic trade-off factor is used to semantically reconstruct the set of factual knowledge fragments to generate an enhanced set of knowledge fragments compatible with counterfactual assumptions, including:

[0025] For each fact knowledge fragment in the set of fact knowledge fragments, extract its semantic dependency graph and identify the key entity nodes and relation edges in the graph;

[0026] Based on the dynamic trade-off factor, the semantic substitution probability of key entity nodes and relation edges is calculated, where the semantic substitution probability is proportional to the value of the dynamic trade-off factor;

[0027] Based on the semantic substitution probability and combined with the semantic embedding vector of the counterfactual assumption, semantically compatible substitution entities and substitution relations are retrieved from the RAG database to generate candidate reconstruction fragments.

[0028] Perform semantic consistency checks on candidate reconstructed fragments and remove fragments whose semantic relevance to the target reasoning task description is lower than a preset third threshold.

[0029] The candidate reconstructed fragments that pass the semantic consistency test will be semantically fused to generate a set of enhanced knowledge fragments that are compatible with counterfactual assumptions.

[0030] Preferably, the target reasoning task description is semantically extended through a multi-layer semantic alignment network to generate an enhanced semantic representation containing counterfactual reasoning paths, including:

[0031] A multi-layer semantic alignment network is constructed, which includes a semantic embedding layer, an inference path generation layer, and a semantic alignment layer.

[0032] In the semantic embedding layer, the target reasoning task description and the enhanced knowledge fragment set are mapped to a unified semantic space to generate task semantic embedding vectors and knowledge semantic embedding vectors.

[0033] In the reasoning path generation layer, multiple candidate counterfactual reasoning paths are generated based on task semantic embedding vectors and knowledge semantic embedding vectors using a bidirectional attention mechanism.

[0034] Candidate counterfactual reasoning paths are scored for their credibility. The credibility score is based on the semantic coherence and factual support of each reasoning step in the path.

[0035] In the semantic alignment layer, candidate counterfactual reasoning paths are weighted and fused by a dynamic trade-off factor to generate an enhanced semantic representation that includes the counterfactual reasoning paths.

[0036] Preferably, calculating the predicate conflict degree between the counterfactual conditional predicate set and each factual knowledge fragment in the factual knowledge fragment set includes:

[0037] For each predicate in the counterfactual conditional predicate set, extract its logical negation form to generate a subset of negation predicates;

[0038] For each fact knowledge fragment in the set of fact knowledge fragments, parse its predicate-argument structure to generate a subset of fact predicates;

[0039] Calculate the semantic overlap between the subset of negative predicates and the subset of factual predicates, and use it as the initial value for the predicate conflict degree;

[0040] We introduce predicate argument alignment weights and adjust the initial value of predicate conflict degree by weighting it based on the semantic similarity of arguments between the counterfactual conditional predicate set and factual knowledge fragments.

[0041] The weighted predicate conflict degree is normalized to generate the final predicate conflict degree.

[0042] Preferably, the semantic consistency check of the candidate reconstructed fragments includes:

[0043] Calculate the cosine similarity between the candidate reconstructed fragment and the semantic embedding vector of the target reasoning task description, and use it as the semantic relevance score;

[0044] Extract the causal relationship chain of the candidate reconstruction fragments, calculate the logical jump probability of each step in the causal relationship chain, and use it as the logical coherence score.

[0045] The semantic relevance score and logical coherence score are weighted and fused to generate a comprehensive consistency score;

[0046] Candidate reconstruction fragments with an overall consistency score below the preset third threshold are removed, while candidate reconstruction fragments that pass the test are retained.

[0047] Preferably, the candidate counterfactual reasoning paths are scored for path credibility, including:

[0048] For each reasoning step in the candidate counterfactual reasoning path, extract its semantic dependency subgraph and calculate the semantic support of the entity relation edges in the subgraph;

[0049] Based on the enhanced knowledge fragment set, supporting fact fragments related to the reasoning steps are retrieved, and the coverage of supporting fact fragments is calculated as the support of factual evidence.

[0050] A path length penalty factor is introduced to normalize the number of reasoning steps in candidate counterfactual reasoning paths, generating a path complexity correction coefficient.

[0051] The path credibility score of candidate counterfactual reasoning paths is generated by weighting and combining semantic support, factual basis support, and path complexity correction coefficient.

[0052] Preferably, the system further includes:

[0053] The feedback module is used to build a dynamic feedback database for semantic enhancement reasoning results. The dynamic feedback database is used to store each semantic enhancement reasoning result and its corresponding user feedback tags.

[0054] Based on user feedback tags, calculate the creativity score and factual accuracy score of the semantically enhanced reasoning results;

[0055] Based on the creativity score and the factual accuracy score, the generation parameters of the dynamic trade-off factor are adjusted to optimize the balance between creative thinking and factual evidence retrieval.

[0056] Cluster analysis is performed on the semantically enhanced reasoning results in the dynamic feedback database to identify high-frequency reasoning patterns and generate reasoning pattern templates.

[0057] The inference pattern template is fed back to the multi-layer semantic alignment network to improve the efficiency and accuracy of subsequent semantic expansion.

[0058] Preferably, the generation parameters of the dynamic tradeoff factor are adjusted based on the creativity score and the factual accuracy score, including:

[0059] A trade-off factor optimization model is constructed, with creativity score and factual accuracy score as the objective functions;

[0060] Pareto frontier analysis was performed on creativity and factual accuracy scores to identify the optimal set of solutions for score combinations;

[0061] Based on the optimal solution set, the gradient update direction of the generation parameters of the dynamic trade-off factor is calculated, where the generation parameters include the conflict intensity normalization coefficient and the creative thinking priority parameter.

[0062] Introduce a parameter to update the damping factor, control the update amplitude of the generated parameters, and avoid excessive oscillation of the trade-off factor;

[0063] The stability of the adjusted dynamic trade-off factor is verified. When the score fluctuation of the semantic enhancement reasoning results is lower than the preset fluctuation threshold for multiple consecutive times, the adjustment is confirmed to be complete.

[0064] The technical effects and advantages of the semantic enhancement processing system based on the RAG database of large-scale intelligent agents in this invention are as follows:

[0065] This invention establishes a precise semantic conflict identification and dynamic balancing mechanism. The system can intelligently adjust its reasoning strategy based on the nature and degree of conflict of counterfactual assumptions, generating high-quality reasoning results that conform to counterfactual premises while maintaining basic rationality. This intelligent balancing ability allows the system to explore rich historical branch possibilities in historical hypothesis analysis without falling into wishful thinking; to construct novel and logically consistent worldviews in science fiction; and to help students understand the importance of key theories and their chain of influence in science education. The system's adaptive optimization characteristics enable it to continuously learn from user interaction, gradually improving its counterfactual reasoning processing strategies in different fields, demonstrating a constantly evolving level of intelligence. Simultaneously, the system maintains high interpretability, allowing users to clearly understand the reasoning process and basis, enhancing the credibility and practical value of the results. Attached Figure Description

[0066] Figure 1 This is a schematic diagram of the semantic enhancement processing system based on the RAG database of large model intelligent agents according to the present invention. Detailed Implementation

[0067] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0068] This invention provides a semantic enhancement processing system based on the RAG database of large-scale intelligent agents. It acquires users' semantic query requests in real time, intelligently processes semantic conflicts between factual knowledge fragments and counterfactual assumptions in the RAG database, constructs precise dynamic trade-off factors and a multi-layer semantic alignment network, and generates semantically enhanced reasoning results by combining creative thinking and factual evidence retrieval. Through dynamic monitoring and parameter adjustment, it achieves accurate matching and efficient generation of counterfactual reasoning. It is highly adaptable, capable of optimizing semantic parameters in real time based on the degree of conflict between counterfactual assumptions and factual knowledge, significantly improving reasoning quality and balancing creativity and factual evidence.

[0069] Please see Figure 1 In this embodiment of the invention, the semantic enhancement processing system based on the large model agent RAG database includes:

[0070] The semantic query parsing module is used to acquire semantic query requests input by the user. These requests include key information such as a description of the target reasoning task and counterfactual assumptions, collected in real time through the user interface. The target reasoning task description directly reflects the user's reasoning needs, while the counterfactual assumptions represent the user's virtual alterations to existing facts. This data provides the foundation for semantic enhancement processing, ensuring the relevance and effectiveness of the reasoning results.

[0071] The knowledge retrieval and conflict identification module is used to retrieve a set of factual knowledge fragments related to the target reasoning task description from the RAG database based on the semantic query request, and extract a subset of binding facts from the factual knowledge fragment set that conflict with counterfactual assumptions. This module first performs dependency parsing on the target reasoning task description to generate a semantic query vector, and then retrieves relevant factual knowledge fragments from the RAG database through multi-scale semantic similarity matching. Next, it performs logical decomposition on the counterfactual assumptions to generate a set of counterfactual predicates, calculates the predicate conflict degree with the factual knowledge fragments, and finally forms a subset of binding facts, laying the foundation for subsequent semantic reconstruction.

[0072] The semantic reconstruction module is used to construct a dynamic trade-off factor based on the semantic conflict intensity of the constraint fact subset. This dynamic trade-off factor characterizes the relative weight of creative thinking generation and factual evidence retrieval. The module determines the local semantic conflict intensity by calculating the angle between the semantic embedding vectors of each factual knowledge fragment and the counterfactual assumption in the constraint fact subset, and introduces conflict distribution entropy to calculate the overall semantic conflict uncertainty. It then constructs a conflict intensity normalization function and finally generates the dynamic trade-off factor. The larger the factor value, the higher the weight of creative thinking.

[0073] A multi-layer semantic alignment network is used to semantically reconstruct the set of factual knowledge fragments using the dynamic trade-off factor, generating an enhanced set of knowledge fragments compatible with counterfactual assumptions. Based on the enhanced knowledge fragment set, the target reasoning task description is semantically extended through the multi-layer semantic alignment network to generate an enhanced semantic representation containing counterfactual reasoning paths. The network first extracts the semantic dependency graph of the factual knowledge fragments, calculates the semantic substitution probability based on the dynamic trade-off factor, retrieves and generates candidate reconstructed fragments, and forms an enhanced knowledge fragment set after semantic consistency verification. Subsequently, multiple candidate counterfactual reasoning paths are generated through a semantic embedding layer, a reasoning path generation layer, and a semantic alignment layer, and then weighted and fused to form the enhanced semantic representation.

[0074] The reasoning result generation module is used to output semantically enhanced reasoning results that balance creative thinking and factual basis, based on the enhanced semantic representation and the constraints of the dynamic trade-off factor. This module generates preliminary reasoning results based on the enhanced semantic representation, and adjusts the weight of creative thinking and factual basis through the dynamic trade-off factor to ensure that the final output reasoning result is both innovative and adequately supported by facts, thus meeting the user's counterfactual reasoning needs.

[0075] The modules are connected via wired and / or wireless means to enable data transmission between them.

[0076] In this embodiment of the invention, the detailed implementation steps of retrieving a set of factual knowledge fragments related to the description of the target reasoning task from the RAG database and extracting a subset of binding facts from the set of factual knowledge fragments that conflict with counterfactual assumptions include:

[0077] Dependency parsing is performed on the target reasoning task description to extract core predicate-argument pairs and generate semantic query vectors. Dependency parsing is a fundamental step in constructing semantic query vectors, extracting the semantic core by parsing the syntactic structure. The analysis process employs a deep learning-based dependency parser to identify structural features such as subject-verb-object relationships and modification / qualification relationships in the sentence, and extracts core predicates and corresponding arguments to form a set of predicate-argument pairs. Each predicate-argument pair represents a basic semantic unit, such as "human moon landing" or "development of electric vehicles." The extracted results are standardized and transformed into fixed-dimensional semantic query vectors, with each dimension corresponding to a specific semantic attribute, providing an accurate query basis for subsequent similarity matching.

[0078] Based on the semantic query vector, multi-scale semantic similarity matching is performed in the RAG database to obtain a set of factual knowledge fragments whose semantic relevance to the core predicate-argument pair exceeds a preset first threshold. Multi-scale semantic similarity matching is a key technology for efficient retrieval of relevant knowledge, finding the most matching knowledge fragments through similarity calculations at different granularities. The matching process first calculates the cosine similarity between the semantic query vector and the knowledge fragment vectors in the RAG database to initially screen the candidate set; then, a hierarchical matching strategy is adopted to perform fine-grained matching at three levels: global semantics, local structure, and key entities, forming a comprehensive similarity score. The calculation formula is:

[0079] ;

[0080] in, To assess overall similarity, For query vector, For knowledge fragment vectors, and The structural representations of queries and knowledge fragments are respectively. and These are the entity sets for queries and knowledge fragments, respectively. , , These are the weighting coefficients, and ; This is a structural similarity function used to calculate the structural representation of the query. Structural representation of knowledge fragments It assesses the degree of similarity between them. It evaluates the matching degree at the semantic structure level, considering the matching of structured features such as syntactic dependency relations, semantic frames, and relational networks; This is an entity matching function used to calculate the set of entities in a query. With the set of entities in the knowledge fragment The degree of matching between entities. It focuses on the overlap of core entities (such as people, places, organizations, concepts, etc.), and usually uses set similarity calculation methods to evaluate entity-level matching. Entity matching function, structural similarity function, and cosine similarity (… Together, these constitute the three dimensions of comprehensive similarity calculation, evaluating the degree of semantic matching from the vector, structure, and entity levels, respectively.

[0081] The similarity calculation results are compared with a preset first threshold (usually 0.75-0.85) to filter out a set of highly relevant factual knowledge fragments, providing a basic dataset for subsequent conflict identification.

[0082] The counterfactual assumptions are logically decomposed to generate a set of counterfactual predicates, and the predicate conflict degree between the counterfactual predicate set and each factual knowledge fragment in the set of factual knowledge fragments is calculated. Logical decomposition is a prerequisite step for identifying semantic conflicts, transforming complex assumptions into basic predicate units. The decomposition process uses semantic frame analysis to parse the counterfactual assumptions into a series of basic propositions and extract the core predicates of each proposition to form a set of counterfactual predicates. For example, "If humans have never landed on the moon" can be decomposed into the negation of "humans," "landed," and "moon." The predicate conflict degree calculation uses a combination of predicate logical matching and semantic contradiction assessment. By comparing the degree of semantic overlap between the negation of the counterfactual predicates and the predicates in the factual knowledge fragments, the degree of conflict is quantified. The conflict degree value ranges from [0,1], with higher values ​​indicating more severe conflicts, providing a basis for identifying the binding fact subset.

[0083] Based on the predicate conflict degree, factual knowledge fragments in the set of factual knowledge fragments whose predicate conflict degree exceeds a preset second threshold are identified and marked as a subset of binding facts. This step achieves precise screening of conflicting facts, identifying key knowledge fragments that directly conflict with the counterfactual hypothesis. The screening process sets a preset second threshold (usually 0.6-0.7) to hard-truncate the predicate conflict degree, marking knowledge fragments with conflict degrees higher than the threshold as a subset of binding facts. The threshold setting considers the balance between accuracy and recall in conflict identification; too high a threshold will miss potential conflicts, while too low a threshold will introduce irrelevant knowledge. The marking results form a subset of binding facts, each fragment having a significant semantic conflict with the counterfactual hypothesis, requiring semantic reconstruction processing.

[0084] Semantic clustering is performed on the factual knowledge fragments in the constrained fact subset to remove duplicate fact fragments with semantic redundancy exceeding a preset redundancy threshold, generating a simplified constrained fact subset. Semantic clustering is a key step in optimizing the constrained fact subset, reducing redundant information and improving subsequent processing efficiency. Hierarchical clustering is used, calculating the similarity matrix between fragments based on their semantic representations, and determining the number of clusters using an adaptive threshold. After clustering, the most representative knowledge fragment (usually the fragment closest to the cluster center) is retained in each category, while duplicate fragments with semantic redundancy exceeding a preset redundancy threshold (usually 0.85) are removed. The processed simplified constrained fact subset retains all key conflicting information while significantly reducing the data size, providing high-quality input data for subsequent semantic reconstruction.

[0085] In this embodiment of the invention, the detailed implementation steps for constructing a dynamic trade-off factor based on the semantic conflict strength of the constraint fact subset include:

[0086] For each factual knowledge fragment in the constrained fact subset, the angle between its semantic embedding vector and the counterfactual assumption is calculated as the local semantic conflict strength. The semantic embedding vector angle is an intuitive indicator of semantic conflict; a smaller angle indicates a closer semantic direction and a weaker conflict, while a larger angle indicates a more opposite semantic direction and a stronger conflict. The calculation process first maps the factual knowledge fragment and the counterfactual assumption to a unified high-dimensional semantic space to obtain standardized semantic embedding vectors, and then calculates the vector angle. The calculation formula is:

[0087] ;

[0088] in, Let be the local semantic conflict strength of the i-th factual knowledge fragment. For semantic embedding vectors of factual knowledge fragments, For the semantic embedding vector of the counterfactual assumption, Represents the vector dot product. The norm of a vector.

[0089] The local semantic conflict intensity range is [0,π], which intuitively reflects the degree of conflict between a single knowledge fragment and counterfactual assumptions, providing basic data for constructing the overall conflict intensity.

[0090] Based on the local semantic conflict intensity, a conflict distribution entropy is introduced to calculate the semantic conflict uncertainty of the entire subset of binding facts. Conflict distribution entropy is an innovative indicator for assessing the overall complexity of conflict, quantifying the uncertainty of conflict distribution through the principle of information entropy. The calculation process first normalizes the local semantic conflict intensity to the interval [0,1], then divides the interval evenly into k buckets (usually k=10), statistically analyzes the conflict intensity frequency of each bucket to form a discrete probability distribution, and finally calculates the information entropy of this distribution. The conflict distribution entropy range is [0,logk], with higher values ​​indicating a more dispersed conflict distribution and more diverse conflict types; lower values ​​indicate a more concentrated conflict distribution and a more singular conflict type. This indicator reflects the conflict complexity between counterfactual assumptions and factual knowledge, providing an important reference for constructing trade-off factors.

[0091] Based on the semantic conflict uncertainty, a conflict intensity normalization function is constructed to map the semantic conflict uncertainty to the [0,1] interval, generating conflict intensity normalization coefficients. The normalization function is a key mechanism for transforming complex indicators into standardized parameters, ensuring consistent comparisons across different scenarios. The function design employs an S-curve, adjusting parameters according to the characteristics of the conflict distribution entropy to provide higher sensitivity in the medium uncertainty region. The calculation formula is as follows:

[0092] ;

[0093] in, This is the normalization coefficient for conflict intensity. For the conflict distribution entropy, The reference entropy value (usually taken as...) ), This is a sensitivity parameter (usually 4-6), which controls the steepness of the curve.

[0094] The normalization coefficient ranges from [0,1], which intuitively reflects the normalization strength of the overall conflict and provides basic parameters for the calculation of dynamic trade-off factors.

[0095] Using the conflict intensity normalization coefficient and a preset creative thinking priority parameter, a dynamic trade-off factor is calculated. A larger value of the dynamic trade-off factor indicates a higher weight for creative thinking. The dynamic trade-off factor is the core mechanism for balancing creative thinking and factual evidence, directly determining the degree of freedom in semantic reconstruction. The calculation process comprehensively considers the conflict intensity normalization coefficient and the preset creative thinking priority parameter, generating the final trade-off factor through a weighted combination. The creative thinking priority parameter reflects the system's basic preference for innovation and is usually preset according to the application scenario. The calculation formula is:

[0096] ;

[0097] in, As a dynamic trade-off factor, This is the normalization coefficient for conflict intensity. This serves as the base weight for creative thinking (usually set at 0.7-0.9). The weighting factor for factual basis (usually 0.3-0.5).

[0098] The range of the dynamic trade-off factor is The closer the value is The higher the weight of creative thinking, the more the system tends to favor innovativeness during semantic reconstruction; the closer the values ​​are... The higher the weight given to factual evidence, the more conservative the system tends to be during semantic reconstruction. This dynamic balancing mechanism ensures that the system can adaptively adjust the balance between creativity and authenticity based on the intensity of conflict.

[0099] The dynamic trade-off factor undergoes time decay correction by incorporating the contextual temporal characteristics of semantic query requests to reduce the interference of historical conflicts on the current trade-off factor. Time decay correction is an innovative mechanism that considers semantic evolution, gradually reducing the system's sensitivity to historical conflicts over time. The correction process analyzes the contextual temporal characteristics of semantic query requests, identifies recurring conflict patterns and their temporal distribution, and introduces an exponential decay function to reduce the weight of long-term conflicts. The corrected dynamic trade-off factor focuses more on recent conflicts, reduces interference from historical accumulation, and ensures the system maintains appropriate freshness and consistency during continuous interaction, improving the timeliness and relevance of inference results.

[0100] In this embodiment of the invention, the detailed implementation steps of using the dynamic trade-off factor to semantically reconstruct the set of factual knowledge fragments and generate an enhanced set of knowledge fragments compatible with counterfactual assumptions include:

[0101] For each factual knowledge fragment in the set of factual knowledge fragments, its semantic dependency graph is extracted, and key entity nodes and relational edges are identified. The semantic dependency graph is a structured representation of the knowledge fragment, intuitively displaying the semantic relationships between entities. The extraction process employs deep learning-based semantic parsing technology to transform textual knowledge into a directed graph structure, where nodes represent entities or concepts, and edges represent semantic relationships between entities. The graph construction considers semantic hierarchy and relationship types, including not only direct relationships but also implicit and hierarchical relationships. Key entity nodes are identified through centrality analysis (associative centrality and proximity centrality), typically selecting nodes with the top 30% centrality; relational edges are filtered through semantic importance scoring, retaining edges that significantly contribute to the overall semantics. The extracted semantic dependency graph provides structured operational objects for subsequent reconstruction, facilitating the precise location and replacement of conflicting elements.

[0102] Based on the dynamic trade-off factor, the semantic substitution probability of the key entity nodes and relation edges is calculated, where the semantic substitution probability is proportional to the value of the dynamic trade-off factor. The semantic substitution probability is a key parameter controlling the degree of reconstruction, directly determining the likelihood of each element being modified. The calculation process combines the dynamic trade-off factor and the conflict degree of the elements to assign a substitution probability to each key entity node and relation edge. The calculation formula is:

[0103] ;

[0104] in, For elements semantic substitution probability, As a dynamic trade-off factor, For elements The normalized conflict degree (value range [0,1]).

[0105] The range of values ​​for the replacement probability is: The probability of substitution is proportional to the dynamic trade-off factor, reflecting the system's degree of freedom in reconstruction: the higher the trade-off factor, the greater the probability of substitution and the bolder the reconstruction; the lower the trade-off factor, the smaller the probability of substitution and the more conservative the reconstruction. This probabilistic mechanism provides controllable randomness for creative reconstruction while maintaining overall semantic coherence.

[0106] Based on the semantic substitution probability and the semantic embedding vector of the counterfactual assumption, semantically compatible replacement entities and relationships are retrieved from the RAG database to generate candidate reconstructed fragments. Semantic compatibility retrieval is a crucial step in finding suitable replacement elements, ensuring that the reconstructed knowledge fragment is consistent with the counterfactual assumption. The retrieval process first calculates the similarity between the element to be replaced and the semantic embedding vector of the counterfactual assumption, identifying the corresponding element in the assumption; then, it searches the RAG database for replacement elements that are semantically compatible with the assumption and functionally equivalent to the original element. Compatibility evaluation employs multi-dimensional matching, including semantic similarity, logical consistency, and functional equivalence, ensuring that the replacement element conforms to the semantic direction of the counterfactual assumption while maintaining its original functional role. The retrieval results form a candidate replacement set, with each element corresponding to multiple possible replacement options, providing a rich selection space for the next reconstruction step.

[0107] The candidate reconstructed fragments undergo semantic consistency testing, and fragments with a semantic relevance to the target reasoning task description below a preset third threshold are eliminated. Semantic consistency testing is a crucial step in ensuring reconstruction quality, filtering out semantic drift or unreasonable reconstruction results. The testing process evaluates candidate reconstructed fragments from two dimensions: semantic relevance and logical coherence. Semantic relevance is assessed by calculating the similarity between the reconstructed fragment and the target reasoning task description, ensuring that the reconstruction does not deviate from the original task objective. Logical coherence is assessed by analyzing the causal chains and logical jumps within the reconstructed fragment, ensuring that the reconstructed knowledge maintains internal consistency. The evaluation results are compared with a preset third threshold (typically 0.65-0.75), eliminating candidate fragments that do not meet the requirements and retaining high-quality reconstruction results. This rigorous quality control ensures the accuracy and reliability of semantic reconstruction, avoiding the generation of meaningless or misleading knowledge fragments.

[0108] Candidate reconstructed fragments that pass the semantic consistency test are semantically fused to generate a set of enhanced knowledge fragments compatible with the counterfactual assumptions. Semantic fusion is a key step in generating the final enhanced knowledge, integrating multiple high-quality candidate fragments into a coherent and consistent knowledge set. The fusion process employs a combination of graph merging and conflict resolution: first, candidate reconstructed fragments are represented as semantic graphs, and overlapping nodes and edges between graphs are identified; then, similar nodes and edges are merged based on graph alignment techniques to resolve potential conflicts and contradictions; finally, the structure of the merged graph is optimized to ensure overall coherence and integrity. The fusion result forms a set of enhanced knowledge fragments, each carefully reconstructed to be compatible with the counterfactual assumptions while maintaining a sufficient factual basis, providing high-quality knowledge support for subsequent semantic expansion.

[0109] In this embodiment of the invention, the detailed implementation steps of semantically extending the target reasoning task description through a multi-layer semantic alignment network to generate an enhanced semantic representation containing counterfactual reasoning paths include:

[0110] A multi-layer semantic alignment network is constructed, comprising a semantic embedding layer, a reasoning path generation layer, and a semantic alignment layer. This multi-layer semantic alignment network is the core architecture for semantic expansion, achieving the transformation from knowledge to reasoning through hierarchical processing. The network design adopts a three-layer structure: the semantic embedding layer is responsible for mapping text to a semantic space, capturing deep semantic features; the reasoning path generation layer is responsible for constructing multiple possible reasoning paths, forming a reasoning skeleton; and the semantic alignment layer is responsible for integrating and optimizing the reasoning paths, generating the final representation. The layers interact through feedforward connections and attention mechanisms, achieving efficient information transfer and fusion. This hierarchical design enables the network to progressively extract high-quality reasoning paths from basic semantic representations, providing structured support for complex counterfactual reasoning.

[0111] In the semantic embedding layer, the target reasoning task description and the enhanced knowledge fragment set are mapped to a unified semantic space, generating task semantic embedding vectors and knowledge semantic embedding vectors. Semantic embedding is a fundamental step in achieving unified representation, transforming text from different sources into comparable and manipulable vector representations. The mapping process employs an encoder based on a pre-trained language model, capturing the deep semantics and potential relationships of the text through a context-sensitive encoding mechanism. For the task description, the encoding focuses on the overall goal and key constraints; for knowledge fragments, the encoding focuses on factual content and causal relationships. The generated semantic embedding vectors are typically high-dimensional dense vectors (512-1024 dimensions), with each dimension corresponding to a specific semantic feature, collectively forming a complete semantic representation. These vectors, within a unified semantic space, facilitate subsequent similarity calculations and semantic operations, providing a basic data structure for reasoning path generation.

[0112] In the reasoning path generation layer, multiple candidate counterfactual reasoning paths are generated using a bidirectional attention mechanism based on the task semantic embedding vector and the knowledge semantic embedding vector. Reasoning path generation is a crucial step in constructing the counterfactual reasoning framework, creating possible reasoning chains through a knowledge-to-task mapping. The generation process employs a bidirectional attention mechanism to establish a dynamic association between task representation and knowledge representation: task-to-knowledge attention identifies key knowledge points required for reasoning; knowledge-to-task attention determines the degree of contribution of knowledge to the task. Based on this bidirectional association, the system adopts a cluster search strategy, starting from the starting point (task description) and gradually constructing multiple possible reasoning paths. Each path consists of a series of knowledge fragments, forming a complete reasoning chain. The number of generated candidate reasoning paths is typically 10-20, covering different reasoning angles and logical branches, providing a rich candidate set for subsequent scoring and selection.

[0113] The candidate counterfactual reasoning paths are scored for reliability based on the semantic coherence and factual support of each reasoning step. Path reliability scoring is a key mechanism for selecting high-quality reasoning paths, quantifying their reliability through multi-dimensional evaluation. The scoring process is conducted from two main dimensions: semantic coherence and factual support. Semantic coherence assesses the logical flow within the path, checking the reasonableness of semantic jumps between adjacent reasoning steps; factual support assesses the factual basis of the path, checking whether each reasoning step has sufficient knowledge support. A weighted average method is used to generate a reliability score between 0 and 1, comprehensively considering all aspects of the path. High-scoring paths typically have a clear logical structure and sufficient factual support, enabling the generation of high-quality counterfactual reasoning; low-scoring paths may have logical jumps or insufficient factual support, requiring further optimization or elimination.

[0114] In the semantic alignment layer, the candidate counterfactual reasoning paths are weighted and fused using the dynamic trade-off factor to generate an enhanced semantic representation containing these paths. Semantic alignment is a crucial step in generating the final representation, optimizing and integrating it to form a high-quality reasoning result. The fusion process first calculates the weight of each path based on its credibility score and the dynamic trade-off factor: higher credibility results in a larger weight. Simultaneously, the trade-off factor balances creativity and factuality; higher factor values ​​give more weight to innovative paths. Then, the candidate paths are weighted and averaged based on the calculated weights to generate a unified representation vector. Finally, a self-attention mechanism is used to fine-tune the representation, enhancing internal consistency and structured features. The generated enhanced semantic representation is a high-dimensional vector that encodes complete counterfactual reasoning information, including preconditions, reasoning steps, and possible conclusions, providing a comprehensive semantic foundation for generating the final reasoning result.

[0115] In this embodiment of the invention, calculating the predicate conflict degree between the counterfactual conditional predicate set and each factual knowledge fragment in the factual knowledge fragment set includes:

[0116] For each predicate in the counterfactual condition predicate set, its logical negation form is extracted to generate a subset of negated predicates. Logical negation is a fundamental step in identifying conflicts, and transforming counterfactual conditions facilitates direct comparison with facts. The extraction process employs a logical semantic framework. First, the semantic type and argument structure of the predicates are analyzed. Then, corresponding negation rules are applied according to the predicate type: for state predicates (such as "is", "has"), direct negation ("is not", "does not"); for action predicates (such as "do", "go"), action negation ("did not do", "did not go"); for relational predicates (such as "greater than", "contains"), relation inversion ("less than or equal to", "does not contain"). The generated subset of negated predicates forms a semantic opposition with the original predicate set, providing a basic comparison unit for conflict degree calculation.

[0117] For each factual knowledge fragment in the set of factual knowledge fragments, its predicate-argument structure is parsed to generate a subset of factual predicates. Predicate-argument parsing is a crucial step in extracting the semantic skeleton of the facts, facilitating structured comparison with negation predicates. The parsing process employs semantic role labeling technology to identify the core predicates and their corresponding arguments in the knowledge fragments, constructing a complete predicate-argument structure. The parsing result forms a subset of factual predicates, where each element contains the predicate itself and its semantic role information, such as agent, patient, time, and place. This structured representation not only preserves the original semantic information but also clarifies the relationships between elements, providing an accurate basis for subsequent conflict degree calculation.

[0118] The semantic overlap between the subset of negation predicates and the subset of fact predicates is calculated as the initial value for the predicate conflict degree. Semantic overlap calculation is the core step in quantifying the degree of conflict, determining the conflict intensity by evaluating the matching degree between the negation predicates and the fact predicates. The calculation process employs a hybrid matching strategy: first, precise matching is performed to find completely consistent predicate-argument structures; then, fuzzy matching is performed to evaluate the degree of partial matching through semantic similarity and structural similarity; finally, the two matching results are combined to generate the overall semantic overlap degree. The overlap degree ranges from [0,1], with higher values ​​indicating more significant conflicts, directly affecting subsequent conflict degree calculations.

[0119] A predicate argument alignment weighting method is introduced to adjust the initial value of the predicate conflict degree based on the semantic similarity of arguments between the counterfactual conditional predicate set and the factual knowledge fragment. Argument alignment is a key mechanism for improving the accuracy of conflict identification, adjusting the conflict intensity through the degree of argument matching. Weight calculation is based on the semantic similarity of arguments, employing different weight coefficients for primary arguments (e.g., agent, patient) and secondary arguments (e.g., time, manner) to reflect the difference in the contribution of arguments to the predicate semantics. The correction process adjusts the initial conflict degree according to the degree of argument alignment: higher alignment results in higher weights, strengthening the conflict signal; lower alignment results in lower weights, weakening the conflict signal. This fine-grained weighting adjustment makes conflict identification more accurate, avoiding misjudgments that may be caused by simple predicate matching, and improving the accuracy and reliability of conflict identification.

[0120] The weighted predicate conflict scores are normalized to generate the final predicate conflict score. Normalization is a crucial step in ensuring the consistency of the conflict score index, facilitating subsequent threshold screening and comparative analysis. The process employs the Min-Max standardization method, mapping the weighted conflict scores to the [0,1] interval to eliminate the influence of dimensions and ensure the comparability of conflict scores across different knowledge fragments. The normalization formula considers the overall conflict distribution and appropriately handles extreme values ​​to avoid distortion of the overall distribution by outliers. The final generated predicate conflict score is a standardized index that intuitively reflects the degree of conflict between counterfactual conditions and factual knowledge, providing a reliable basis for identifying constrained fact subsets.

[0121] In this embodiment of the invention, the semantic consistency check of the candidate reconstructed fragment includes:

[0122] The cosine similarity between the candidate reconstructed fragment and the semantic embedding vector of the target inference task description is calculated as the semantic relevance score. Semantic relevance assessment is a crucial step in ensuring the correct reconstruction direction, quantifying the semantic consistency between the reconstructed fragment and the original task through vector similarity. The calculation process first obtains the semantic embedding vectors of the candidate reconstructed fragment and the target inference task description, and then calculates their cosine similarity. Similarity calculation employs standardization to eliminate the influence of vector length differences, ensuring the objectivity and comparability of the results. The similarity value ranges from [-1, 1], with values ​​closer to 1 indicating greater semantic similarity and a better alignment with the original task objective; lower values ​​indicate more severe deviations, requiring adjustment or removal. The semantic relevance score directly reflects the task relevance of the reconstructed fragment and is the primary indicator for semantic consistency verification.

[0123] The causal relationship chain of the candidate reconstructed fragments is extracted, and the logical jump probability of each step in the causal relationship chain is calculated as the logical coherence score. Logical coherence assessment is a crucial step in ensuring internal consistency of the reconstruction, quantifying the logical integrity of the reconstructed fragments by analyzing the causal chain structure. The assessment process first extracts the causal relationship chain in the reconstructed fragments, identifying each causal step and its association; then, it calculates the logical jump probability between adjacent steps to assess the naturalness and fluency of the reasoning process; finally, it synthesizes the jump probabilities of each step to generate an overall logical coherence score. The score calculation considers the length and complexity of the causal chain, and standardization is applied to chains of different lengths to ensure fairness and comparability in the scoring. The logical coherence score ranges from [0,1], with higher values ​​indicating more coherent internal logic and higher reconstruction quality; lower values ​​indicate more obvious logical jumps, requiring further optimization.

[0124] The semantic relevance score and the logical coherence score are weighted and fused to generate a comprehensive consistency score. Weighted fusion is a key step in comprehensively evaluating the reconstruction quality, integrating multi-dimensional indicators to form a comprehensive quality assessment. The fusion process uses a linear weighting method, adjusting the weight ratio of the two indicators according to the application scenario: for scenarios emphasizing task relevance, semantic relevance has a higher weight; for scenarios emphasizing internal consistency, logical coherence has a higher weight. Under standard configuration, an equal weight setting (0.5:0.5) is typically used, which can be dynamically adjusted in specific scenarios. The fusion formula is a weighted average, ensuring that the final score remains within the [0,1] range, facilitating comparison with thresholds and horizontal comparisons. The comprehensive consistency score comprehensively reflects the quality level of the reconstructed fragment, providing an objective basis for subsequent screening.

[0125] Candidate reconstructed fragments with an overall consistency score below a preset third threshold are discarded, while those that pass the test are retained. Threshold screening is a crucial step in ensuring final quality, eliminating substandard reconstruction results through a rigid standard. The screening process compares the overall consistency score of each candidate fragment with a preset third threshold (typically 0.65-0.75). Fragments below the threshold are marked as substandard and removed from the candidate set. The threshold setting is dynamically adjusted based on the quality standards required by the application: higher thresholds are set for scenarios requiring high-quality output; lower thresholds are used for scenarios seeking diversity and innovation. The selected set of candidate reconstructed fragments exhibits high semantic relevance and logical coherence, ensuring the input quality for subsequent semantic fusion and laying the foundation for generating a high-quality set of enhanced knowledge fragments.

[0126] In this embodiment of the invention, the step of scoring the path credibility of the candidate counterfactual reasoning path includes:

[0127] For each reasoning step in the candidate counterfactual reasoning path, its semantic dependency subgraph is extracted, and the semantic support of the entity relationship edges in the subgraph is calculated. Semantic support is a fundamental indicator for evaluating the reliability of reasoning steps, quantifying the internal support strength of reasoning by analyzing the semantic structure. The extraction process first represents the reasoning steps as a semantic dependency subgraph, with nodes representing entities or concepts and edges representing semantic relationships between entities; then, the support strength of each relationship edge is evaluated, including three levels: direct evidence support, indirect reasoning support, and common sense knowledge support; finally, the support strength of each edge is combined to calculate the overall semantic support. The support calculation considers the relationship type and strength distribution, giving higher weight to key relationships to ensure that the score reflects the core reliability of the reasoning steps. The semantic support value ranges from [0,1], intuitively reflecting the internal consistency and structural integrity of the reasoning steps, providing basic data for path credibility scoring.

[0128] Based on the enhanced knowledge fragment set, supporting fact fragments related to the reasoning step are retrieved, and the coverage rate of these supporting fact fragments is calculated as the factual basis support. Factual basis support is a key indicator for evaluating external evidence in reasoning, quantifying the factual foundation of the reasoning through retrieval matching. The evaluation process first transforms the reasoning step into a query representation, retrieving relevant supporting fact fragments from the enhanced knowledge fragment set; then, it calculates the coverage rate of the retrieval results to the reasoning step, evaluating the completeness of factual support; finally, it weights the supporting fragments based on their relevance and authority to generate the final factual basis support. The support calculation uses a piecewise function, setting different growth slopes for different coverage intervals, reflecting the non-linear effect of factual support: in the low coverage interval, support grows slowly; in the medium coverage interval, support grows rapidly; and in the high coverage interval, support tends to saturate. The factual basis support value ranges from [0,1], intuitively reflecting the degree of external evidence support for the reasoning step and providing an important basis for comprehensive scoring.

[0129] A path length penalty factor is introduced to normalize the number of reasoning steps in the candidate counterfactual reasoning paths, generating a path complexity correction coefficient. The path length penalty is a key mechanism for controlling reasoning complexity, encouraging concise and efficient reasoning by penalizing lengthy paths. The penalty factor design is based on Occam's razor, favoring simpler reasoning paths when explanatory power is similar. The calculation uses a logarithmic penalty function; the penalty intensity gradually increases with path length, but the rate of increase slows down to avoid over-penalizing necessary complex reasoning. The correction coefficient ranges from (0,1], with a coefficient of 1 for single-step reasoning, gradually decreasing as the number of steps increases, intuitively reflecting the simplicity of the reasoning path and providing a complexity adjustment factor for credibility scoring.

[0130] The semantic support, factual evidence support, and path complexity correction coefficient are weighted and combined to generate a path credibility score for the candidate counterfactual reasoning path. This weighted combination is a crucial step in generating the comprehensive score, integrating multi-dimensional indicators to form a comprehensive credibility evaluation. The combination process employs a multiplicative model, multiplying the weighted average of semantic support and factual evidence support by the path complexity correction coefficient, while ensuring the final score falls within the [0,1] interval. The calculation formula is as follows:

[0131] ;

[0132] in, Score the path credibility. For semantic support, As for the degree of support based on facts, This is a path complexity correction factor. and These are the weighting coefficients, and .

[0133] The path credibility score comprehensively reflects the quality level of candidate inference paths, taking into account three dimensions: internal consistency, external support, and structural simplicity. It provides an objective basis for subsequent path selection and fusion, ensuring that the final generated enhanced semantic representation has high reliability and rationality.

[0134] In this embodiment of the invention, the system further includes:

[0135] The feedback module is used to construct a dynamic feedback database for semantically enhanced reasoning results. This database stores each semantically enhanced reasoning result and its corresponding user feedback tags. Based on the user feedback tags, it calculates the creativity score and factual accuracy score of the semantically enhanced reasoning results. According to the creativity score and the factual accuracy score, it adjusts the generation parameters of the dynamic trade-off factor to optimize the balance between creative thinking and factual evidence retrieval. It performs cluster analysis on the semantically enhanced reasoning results in the dynamic feedback database to identify high-frequency reasoning patterns and generate reasoning pattern templates. The reasoning pattern templates are then fed back to the multi-layer semantic alignment network to improve the efficiency and accuracy of subsequent semantic expansion.

[0136] The feedback module is a key component for continuous system optimization, enabling adaptive adjustments through the collection of user feedback. The dynamic feedback database employs a distributed storage structure, supporting efficient data reading and writing as well as complex queries. Each record contains the reasoning result, user feedback tags, and contextual information, forming a complete feedback sample. User feedback is obtained through explicit ratings and implicit behavioral analysis, covering the two core dimensions of creativity and factual accuracy. Based on this feedback, the system dynamically adjusts the parameters of the trade-off factors, optimizing the balance between creativity and factual accuracy. Simultaneously, successful reasoning patterns are identified through cluster analysis, extracted as templates, and fed back to the semantic alignment network to improve the efficiency and quality of subsequent reasoning. This closed-loop optimization mechanism allows the system to continuously learn from user interactions, constantly improving its reasoning capabilities and achieving incremental performance enhancements.

[0137] In this embodiment of the invention, adjusting the generation parameters of the dynamic trade-off factor based on the creativity score and the factual accuracy score includes:

[0138] A tradeoff factor optimization model is constructed, with the creativity score and the factual accuracy score as objective functions. This optimization model forms the theoretical basis for parameter adjustment, guiding the adjustment direction through a formalized objective function. The model construction employs a multi-objective optimization framework, setting the creativity score and factual accuracy score as two optimization objectives while considering the tradeoffs between them. The objective function is designed using a weighted sum form, adjusting the relative importance of the two objectives according to the application scenario requirements. The model also introduces constraints to ensure that the adjusted parameters remain within an effective range, avoiding over-optimization that could lead to system instability. This objective function-based optimization model provides clear theoretical guidance for parameter adjustment, ensuring the scientific rigor and goal-orientation of the adjustment process.

[0139] Pareto front analysis is performed on the creativity score and the factual accuracy score to identify the optimal solution set for the score combination. Pareto front analysis is a key technique for handling multi-objective optimization, finding the optimal parameter combination through non-dominated ranking. The analysis process first plots historical feedback data in a two-dimensional space according to the creativity score and the factual accuracy score, forming a score scatter plot; then, the Pareto non-dominated ranking algorithm is applied to identify the set of frontier points that are not dominated by any other points; finally, based on the system's current optimization preferences, the best-matching parameter combination is selected from the frontier set. Pareto fronts provide an optimal balance set of points between the two objectives of creativity and factual accuracy, avoiding the bias that may be caused by single-dimensional optimization, and providing a balanced optimization direction for parameter adjustment.

[0140] Based on the optimal solution set, the gradient update direction of the generation parameters of the dynamic tradeoff factor is calculated, wherein the generation parameters include the conflict intensity normalization coefficient and the creative thinking priority parameter. Gradient update is the core mechanism of parameter adjustment, determining the parameter adjustment direction by calculating the direction of change of the objective function. The calculation process first determines the gap between the current system state and the target state based on the optimal solution set; then, based on historical data analysis, it constructs a parameter-scoring sensitivity matrix by analyzing the impact of parameter changes on the score; finally, it calculates the gradient update direction of the parameters based on the sensitivity matrix and the target gap. The update direction calculation adopts the gradient ascent method, adjusting the parameters along the direction that maximizes the improvement of the objective function value. This gradient-based update mechanism ensures the efficiency of parameter adjustment and the consistency of the target, providing a mathematical basis for the continuous optimization of system performance.

[0141] A parameter update damping factor is introduced to control the update amplitude of the generated parameters and avoid excessive oscillation of the trade-off factors. The damping factor is a key mechanism for ensuring system stability, preventing drastic parameter fluctuations by limiting the amplitude of each update. The damping mechanism design considers historical update frequency and amplitude, applying a stronger damping effect to frequently updated parameters to avoid overreaction; and maintaining appropriate flexibility for long-term stable parameters to ensure the system's responsiveness to environmental changes. The damping factor's value range is typically [0.1, 0.5], dynamically adjusted according to system stability requirements: a smaller damping factor is used for new systems or under drastically changing environments, allowing for larger adjustments; a larger damping factor is used for mature systems or under stable environments, limiting the adjustment amplitude. This damping mechanism effectively prevents excessive parameter oscillations while ensuring optimization effects, ensuring a smooth improvement in system performance.

[0142] The adjusted dynamic tradeoff factor undergoes stability verification. The adjustment is considered complete when the score fluctuation of multiple consecutive semantic enhancement inference results falls below a preset fluctuation threshold. Stability verification is a crucial step in ensuring the effectiveness of parameter adjustments, and its effect is evaluated by continuously monitoring system performance changes. The verification process employs a sliding window method, continuously monitoring the score fluctuation of inference results n times (typically 5-10 times), calculating the standard deviation, and comparing it with the preset fluctuation threshold. The fluctuation threshold is set based on the application's stability requirements, typically 5%-10% of the baseline score. When multiple consecutive score fluctuations fall below the threshold, it indicates that the system has reached a new stable state, and parameter adjustment is complete; if the fluctuation continues to exceed the threshold, further optimization of the adjustment strategy is required. This stability-based verification mechanism ensures the effectiveness and reliability of parameter adjustments, avoids performance fluctuations that may result from blind adjustments, and provides a stable optimization guarantee for the system.

[0143] The adaptive balancing feature of this invention can adjust the weight of creative thinking and factual basis in real time according to the degree of conflict between counterfactual assumptions and factual knowledge, significantly improving the quality of counterfactual reasoning and generating semantically enhanced results that are both innovative and based on facts.

[0144] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.

[0145] It should be noted that all formulas in this manual are calculated by removing dimensions and taking their numerical values. The formulas are derived from software simulations based on a large amount of collected data to obtain the most recent real-world results. The preset parameters and thresholds in the formulas are set by those skilled in the art according to the actual situation.

[0146] Although embodiments of the invention have been shown and described, those skilled in the art will understand that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the claims and their equivalents.

Claims

1. A semantic enhancement processing system based on the RAG database of large-scale intelligent agents, characterized in that, include: The semantic query parsing module is used to obtain the semantic query request input by the user, which includes a description of the target reasoning task and counterfactual assumptions. The knowledge retrieval and conflict identification module is used to retrieve a set of factual knowledge fragments related to the description of the target reasoning task from the RAG database based on the semantic query request, and extract a subset of binding facts in the set of factual knowledge fragments that conflict with the counterfactual assumptions. The semantic reconstruction module is used to construct a dynamic trade-off factor based on the semantic conflict strength of the constraint fact subset, including: For each fact knowledge fragment in the constraining fact subset, calculate the angle between its semantic embedding vector and the counterfactual assumption, as the local semantic conflict strength; Based on the local semantic conflict intensity, conflict distribution entropy is introduced to calculate the semantic conflict uncertainty of the entire subset of binding facts. Based on the semantic conflict uncertainty, a conflict intensity normalization function is constructed to map the semantic conflict uncertainty to the [0,1] interval, and a conflict intensity normalization coefficient is generated; Using the conflict intensity normalization coefficient and a preset creative thinking priority parameter, a dynamic trade-off factor is calculated; the dynamic trade-off factor is then corrected for time decay. A multi-layer semantic alignment network is used to semantically reconstruct the set of factual knowledge fragments using the dynamic trade-off factor, generating an enhanced set of knowledge fragments compatible with counterfactual assumptions, including: For each fact knowledge fragment in the set of fact knowledge fragments, extract its semantic dependency graph and identify the key entity nodes and relation edges in the graph; Based on the dynamic trade-off factor, the semantic substitution probability of the key entity node and relation edge is calculated; according to the semantic substitution probability, combined with the semantic embedding vector of the counterfactual assumption, semantically compatible substitution entities and substitution relations are retrieved from the RAG database to generate candidate reconstruction fragments. Perform semantic consistency checks on the candidate reconstructed fragments and remove fragments whose semantic relevance to the target reasoning task description is lower than a preset third threshold. The candidate reconstructed fragments that pass the semantic consistency test are semantically fused to generate an enhanced knowledge fragment set that is compatible with the counterfactual assumption. Based on the enhanced knowledge fragment set, the target reasoning task description is semantically extended through a multi-layer semantic alignment network to generate an enhanced semantic representation containing counterfactual reasoning paths; The reasoning result generation module is used to output semantically enhanced reasoning results based on the enhanced semantic representation and the constraints of the dynamic trade-off factor.

2. The semantic enhancement processing system based on the RAG database of large-scale intelligent agents according to claim 1, characterized in that, The step of retrieving a set of factual knowledge fragments related to the target reasoning task description from the RAG database, and extracting a subset of constraining facts from the set of factual knowledge fragments that conflict with counterfactual assumptions, includes: Dependency parsing is performed on the target reasoning task description to extract core predicate-argument pairs and generate semantic query vectors; Based on the semantic query vector, multi-scale semantic similarity matching is performed in the RAG database to obtain a set of factual knowledge fragments whose semantic relevance to the core predicate-argument pair exceeds a preset first threshold. The counterfactual assumptions are logically decomposed to generate a set of counterfactual predicates, and the predicate conflict degree between the counterfactual predicates and each factual knowledge fragment in the set of factual knowledge fragments is calculated. Based on the predicate conflict degree, identify fact knowledge segments in the fact knowledge segment set whose predicate conflict degree exceeds a preset second threshold, and mark them as a constraint fact subset; Semantic clustering is performed on the fact knowledge fragments in the constraint fact subset, and duplicate fact fragments with semantic redundancy exceeding a preset redundancy threshold are removed to generate a simplified constraint fact subset.

3. The semantic enhancement processing system based on the RAG database of large-scale intelligent agents according to claim 1, characterized in that, The step of semantically extending the target reasoning task description through a multi-layer semantic alignment network to generate an enhanced semantic representation containing counterfactual reasoning paths includes: A multi-layer semantic alignment network is constructed, which includes a semantic embedding layer, a reasoning path generation layer, and a semantic alignment layer. In the semantic embedding layer, the target reasoning task description and the enhanced knowledge fragment set are respectively mapped to a unified semantic space to generate task semantic embedding vectors and knowledge semantic embedding vectors; In the reasoning path generation layer, multiple candidate counterfactual reasoning paths are generated based on the task semantic embedding vector and the knowledge semantic embedding vector using a bidirectional attention mechanism. The candidate counterfactual reasoning paths are scored for path credibility, which is based on the semantic coherence and factual support of each reasoning step in the path. In the semantic alignment layer, the candidate counterfactual reasoning paths are weighted and fused in conjunction with the dynamic trade-off factor to generate an enhanced semantic representation that includes the counterfactual reasoning paths.

4. The semantic enhancement processing system based on the RAG database of large-scale intelligent agents according to claim 2, characterized in that, The calculation of the predicate conflict degree between the counterfactual conditional predicate set and each factual knowledge fragment in the factual knowledge fragment set includes: For each predicate in the counterfactual conditional predicate set, extract its logical negation form to generate a subset of negation predicates; For each fact knowledge fragment in the set of fact knowledge fragments, its predicate-argument structure is parsed to generate a subset of fact predicates; Calculate the semantic overlap between the subset of negation predicates and the subset of fact predicates, and use it as the initial value for the predicate conflict degree; A predicate argument alignment weight is introduced, and the initial value of the predicate conflict degree is adjusted by weighting based on the argument semantic similarity between the counterfactual conditional predicate set and the factual knowledge fragment. The weighted predicate conflict degree is normalized to generate the final predicate conflict degree.

5. The semantic enhancement processing system based on the RAG database of large-scale intelligent agents according to claim 1, characterized in that, The semantic consistency check of the candidate reconstructed fragments includes: Calculate the cosine similarity between the candidate reconstructed fragment and the semantic embedding vector described by the target reasoning task, and use it as the semantic relevance score; Extract the causal relationship chain of the candidate reconstructed fragments, calculate the logical jump probability of each step in the causal relationship chain, and use it as the logical coherence score; The semantic relevance score and the logical coherence score are weighted and fused to generate a comprehensive consistency score; Candidate reconstruction segments with an overall consistency score lower than a preset third threshold are removed, while candidate reconstruction segments that pass the test are retained.

6. The semantic enhancement processing system based on the RAG database of large-scale intelligent agents according to claim 3, characterized in that, The process of scoring the credibility of the candidate counterfactual reasoning paths includes: For each reasoning step in the candidate counterfactual reasoning path, extract its semantic dependency subgraph and calculate the semantic support of entity relation edges in the subgraph; Based on the enhanced knowledge fragment set, supporting fact fragments related to the reasoning step are retrieved, and the coverage of supporting fact fragments is calculated as the support level of factual basis; A path length penalty factor is introduced to normalize the number of reasoning steps in the candidate counterfactual reasoning path, thereby generating a path complexity correction coefficient. The semantic support, the factual basis support, and the path complexity correction coefficient are weighted and combined to generate the path credibility score of the candidate counterfactual reasoning path.

7. The semantic enhancement processing system based on the RAG database of large-scale intelligent agents according to claim 1, characterized in that, The system also includes: The feedback module is used to construct a dynamic feedback database for semantic enhancement reasoning results. The dynamic feedback database is used to store each semantic enhancement reasoning result and its corresponding user feedback tags. Based on the user feedback tags, calculate the creativity score and factual accuracy score of the semantically enhanced reasoning result; The generation parameters of the dynamic trade-off factor are adjusted based on the creativity score and the factual accuracy score. Cluster analysis is performed on the semantically enhanced reasoning results in the dynamic feedback database to identify high-frequency reasoning patterns and generate reasoning pattern templates; The inference pattern template is fed back to the multi-layer semantic alignment network to improve the efficiency and accuracy of subsequent semantic expansion.

8. The semantic enhancement processing system based on the RAG database of large-scale intelligent agents according to claim 7, characterized in that, The step of adjusting the generation parameters of the dynamic trade-off factor based on the creativity score and the factual accuracy score includes: Construct a trade-off factor optimization model, wherein the creativeness score and the factual accuracy score are the objective functions; Pareto front analysis was performed on the creativity score and the factual accuracy score to identify the optimal solution set for the score combination; Based on the optimal solution set, the gradient update direction of the generation parameters of the dynamic trade-off factor is calculated, wherein the generation parameters include the conflict intensity normalization coefficient and the creative thinking priority parameter. A parameter is introduced to update the damping factor, thereby controlling the update magnitude of the generated parameter; The stability of the adjusted dynamic trade-off factor is verified. When the score fluctuation of the semantic enhancement reasoning results is lower than the preset fluctuation threshold for multiple consecutive times, the adjustment is confirmed to be complete.