Error correction type RAG method for self-adaptive re-retrieval and evidence purification
By employing an adaptive re-retrieval and evidence cleansing error-correcting RAG method, the problem of insufficient accuracy, timeliness, and verifiability of answers in professional document question-answering tasks in existing technologies is solved. This method achieves the generation of high-quality answers and traceability, and is applicable to various professional document question-answering scenarios such as legal provisions and technical standards.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-16
- Publication Date
- 2026-03-27
AI Technical Summary
When applied to professional fields such as regulations and standard documents, the existing RAG method lacks quality inspection and self-correction mechanisms, has insufficient adaptability, suffers from systemic defects in evidence processing, and lacks adequate guarantees of timeliness and verifiability. Furthermore, the design of the stopping criteria is unreasonable, making it difficult to guarantee the accuracy, timeliness, and verifiability of the answers.
An error-correcting RAG method with adaptive re-retrieval and evidence cleansing is adopted. Through ternary confidence assessment and doubt discrimination mechanism, a multidimensional doubt feature vector is constructed. The optimal strategy is selected using the contextual bandit framework, evidence cleansing and time-weighted ranking are performed, an inline citation mechanism is implemented, and a multi-criteria stopping mechanism is combined to ensure the quality of the answer.
It significantly improves answer accuracy, reduces the generation of hallucinogenic content, achieves a balance between accuracy improvement and cost control, ensures the information density of the evidence set and the verifiability of the answers, and is suitable for various professional document question-and-answer scenarios.
Smart Images

Figure CN121743445A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of shower, and particularly to a self-adaptive re-retrieval and evidence purification error correction RAG method. BACKGROUND
[0002] Retrieval-Augmented Generation (RAG) technology, as an important method combining information retrieval and natural language generation, is widely used in knowledge question answering, document understanding and other scenarios. The basic workflow is as follows: first, relevant document fragments are retrieved from the knowledge base as evidence according to the user query, and then the retrieved evidence and the query are input into the generation model to generate an answer supported by the evidence.
[0003] The existing RAG method usually adopts a hybrid retrieval strategy in the retrieval stage, combining sparse retrieval (such as BM25) and vector retrieval (such as dual tower encoder, ColBERT, and other late interaction models) to recall candidates, and then re-ranking through a cross-encoder, and finally selecting the top-K evidence fragments. In the generation stage, the evidence fragments and the original query are concatenated and input into a large language model to generate the final answer through prompt engineering or instruction fine-tuning. However, the existing RAG method has the following main problems when applied to professional fields such as regulations and standard documents: Firstly, there is a lack of quality detection and self-correction mechanism. Existing methods mostly adopt a linear process of one-time retrieval and generation. When the quality of the initial retrieval evidence is poor (such as insufficient evidence, low relevance, and outdated content), the generation model is prone to produce hallucinated content or incorrect references, and there is a lack of detection mechanism to identify suspicious answers and trigger the correction process. This makes it difficult to guarantee the credibility of the answer in the case of incomplete evidence coverage or version conflicts.
[0004] Secondly, the re-retrieval strategy lacks adaptability. Some existing works try to introduce a re-retrieval mechanism, but mostly adopt fixed strategies such as simple query rewriting or increasing the recall number K. Such methods fail to select appropriate optimization strategies according to different suspiciousness types (no evidence support, insufficient evidence coverage, version conflict, inconsistent path, etc.), resulting in limited re-retrieval effectiveness and high computational cost. At the same time, there is a lack of cost and benefit trade-off mechanism, which cannot find a balance point between quality improvement and time delay overhead.
[0005] Thirdly, there are systematic defects in evidence processing. Existing methods mainly rely on relevance ranking in evidence selection and organization, but in professional document scenarios, the retrieved evidence often contains a large amount of near-duplicate content, cross-version conflict information, and invalid reference paths. The lack of systematic purification mechanisms for these problems, especially the insufficient weighting processing in the time dimension, leads to pollution of the final generation results by outdated or conflicting information.
[0006] Fourth, the timeliness and verifiability are not guaranteed. The regulatory system document has a clear effective and invalid time, and there may be conflicts or update replacement relationship between different versions. The existing RAG method lacks effective modeling of the timeliness of evidence, and cannot ensure the validity of the reference content at a specific time point. At the same time, the corresponding relationship between the generated answer and the supporting evidence is not clear enough, and it is difficult to support subsequent fact verification and audit traceability.
[0007] Fifth, the stop criterion design is unreasonable. The existing method either adopts fixed rounds of iteration or judges based on a single index, lacking an intelligent stop mechanism that comprehensively considers answer quality, marginal benefit, calculation cost and time delay constraints. This leads to either premature stopping with substandard answer quality or excessive iteration with high cost and diminishing returns.
[0008] In summary, the root causes of the above problems mainly include: 1. The existing RAG method regards retrieval and generation as relatively independent steps, lacking a closed-loop optimization mechanism based on generation quality feedback; 2. In evidence processing, relevance is emphasized while timeliness and consistency are ignored; 3. In strategy selection, experience rules are relied on rather than data-driven adaptive decisions.
[0009] These deficiencies make it difficult for existing technologies to simultaneously guarantee the accuracy, timeliness and verifiability of answers when facing time-sensitive and version-complex professional document question answering tasks. SUMMARY
[0010] To overcome the above-mentioned defects, the purpose of the present application is to provide an adaptive re-retrieval and evidence purification error correction RAG method, which solves the problem that the existing technology is difficult to simultaneously guarantee the accuracy, timeliness and verifiability of answers when facing time-sensitive and version-complex professional document question answering tasks.
[0011] To achieve this purpose, the present application adopts the following technical solutions: An adaptive re-retrieval and evidence purification error correction RAG method, comprising the following steps: S1: receiving a query Q and a candidate document Set, perform initial RAG process on query Q, use hybrid retrieval strategy of sparse retrieval and vector retrieval to obtain evidence set And generate draft , calculate retrieval margin , coverage , three confidence of generation consistency , get fusion confidence score: ; Wherein α, β, γ>0 satisfies α+β+γ=1, F0∈[0,1] represents the comprehensive quality score, which is used as the quality evaluation benchmark.
[0012] S2: Construct a multidimensional suspiciousness feature vector Calculate the suspicion score: ; in For the sigmoid function, and These are the parameters obtained through training with preset parameters. This indicates the degree of doubt surrounding the answer; a higher value indicates a more serious problem with the answer's quality. Based on suspicion score and initial fusion confidence score Set a trigger condition to determine whether to start the re-retrieval process: the trigger condition is Sus≥τ sus Or F0 < τ qua (Q), where τ sus τ is the threshold for the suspicion score. qua (Q) is a dynamic quality threshold based on query features, used to adaptively adjust the strictness of the triggering conditions. When either of these two conditions is met, the system automatically triggers step S3; when the triggering conditions are not met, i.e., Sus < τ, the system automatically triggers the execution of step S3. sus And F0≥τ qua (Q) Then directly execute step S7 and output the initially generated draft A0 as the final answer; S3: Select the optimal strategy using the contextual Bandit framework:
[0013] in For the first The optimal strategy for round selection, where A is the set of strategies. , Let C(a) be the expected reward of executing strategy a, and let C(a) be the time delay cost of executing strategy a. This is the latency trade-off coefficient, used to balance the trade-off between benefits and latency; S4: Based on the selected strategy Perform the corresponding re-retrieval operation to obtain the expanded evidence pool: ; S5: Perform similarity clustering on the expanded evidence pool, calculate the comprehensive purification weight, and obtain the purified evidence set through intra-cluster selection and cross-cluster coverage optimization. ; S6: Based on a purified evidence set Regenerate Draft Recalculate the ternary confidence level With fusion score The iteration is terminated by a multi-criteria stopping mechanism. If it is terminated, step S7 is executed; otherwise, step S3 is returned. S7: Regarding the final answer A final Enforce inline citations and apply them to the final answer A. final Perform conflict detection and output verifiable results; where the final answer is A. final Draft A corresponding to satisfying the stopping condition in step S6 t+1 Verifiable results include: the final answer text with formatted clause references §clause_id|eff=YYYY-MM-DD|exp=YYYY-MM-DD, and a conflict detection report.
[0014] Preferably, in step S1: In sparse retrieval, the BM25 model is used to calculate query Q and candidate document D. i term matching score sparse (Q,D i This score is used for the initial recall of the sparse retrieval channel, retaining the Top-K1 candidate documents with the highest term matching scores; In vector retrieval, a late interaction model is used to combine query Q and candidate documents D. i Encode the data as a token-level vector sequence, and calculate the semantic similarity score using MaxSim operations. sparse (Q,D i This similarity is used for the initial recall of the vector retrieval channel, retaining the Top-K2 candidate documents with high semantic similarity; The candidate results from the two search channels are fused, with the candidate results from the sparse search channel being based on the term matching score. sparse The top-K1 candidate documents recalled by (Q,Di) are the candidate results of the vector retrieval channel based on semantic similarity score. sparse (Q,Di) is the top-K2 candidate document sets recalled. The fusion method is to take the union of the two candidate document sets to obtain the candidate document set D'={Di}. For each document Di in the fused candidate document set D', the query Q is compared with the candidate document D using a cross encoder. i Perform pairing and calculate the relevance score of each pair. Relevance score After normalization, the range is between [0,1]. Relevance score Sort all documents in the candidate document set D' in descending order, and select the Top-N documents as candidate evidence to obtain an ordered initial evidence set E0={Di}. Each piece of evidence contains a text fragment, clause ID, source, and time limit τ(Di)=[t eff ,t exp ), where t eff For the effective date, t exp The expiration date is the query time. Then the evidence is valid.
[0015] Preferred, Search margin ;in To score by relevance The relevance scores of the first two pieces of evidence, ranked in descending order (i.e., the first and second ranked pieces of evidence). These are the average scores for the positive and negative evidence sets, respectively. For the weighting factor; Initial answer generated based on E0. The generation process is as follows: query With the initial set of evidence The evidence text is concatenated to form a prompt word input large language model (LLM). The LLM then outputs the initial answer based on this prompt word through an autoregressive generation method. Coverage ,in This is the feature extraction function. For the weighting factor; Generate Consistency
[0016] in For the set of key statements, Score NLI Let SelfAgree be the set of answer reference declarations, and SelfAgree be the self-consistency score. This is a weighting factor.
[0017] Preferably, in step S2, the multidimensional suspiciousness feature vector Features include: no-evidence indicator Low coverage Version conflict ,in For query time constraints; path inconsistency Numerical conflict This represents the ratio of the range to the median within the same unit. The above features together constitute the suspicious feature vector. This vector serves as the input to the suspiciousness discriminator in step S2, used to calculate the suspiciousness score. .
[0018] Preferably, in step S3, the strategy selection is first based on the context features of the current iteration round. To make predictions, among which It integrates query Q and the current evidence set E. t and the current answer Multidimensional information, prediction strategy library The expected returns and costs of each strategy are given, with the expected returns approximated as follows: The cost is approximately This indicates the estimated additional latency incurred by implementing this strategy.
[0019] Preferably, in step S4, the strategy for generating evidence through rewrite is: for each query rewrite variant... The retrieval and cross-encoder reordering are performed independently to obtain the set of retrieval results corresponding to the variant. Then, the retrieval results of all variants are merged to obtain the union of candidate evidence. Expanding the strategy for generating evidence: increasing the recall quota for retrieval. This means increasing the number of candidate pieces of evidence while relaxing the time constraint window. This involves expanding the timeframe of the query and supplementing it with relevant versions and associated standard documents to obtain a wider range of evidence sources. Denoise-filtered evidence strategy: Implement quality control during the candidate screening stage of retrieval: Use MinHash or HNSW nearest neighbor algorithms to detect and remove near-duplicate documents in candidate evidence, and eliminate expired evidence that does not meet timeliness requirements. Prioritize retaining high-confidence clauses that directly match the assigned number.
[0020] Preferably, step S5 includes the following steps: S5-1: Calculate the vector embedding of each piece of evidence. Using HDBSCAN or K-Means algorithms based on vector embedding Similarity clustering is performed to obtain a set of clusters. and the cluster center of each cluster For each piece of evidence Calculate the overall purification weight:
[0021] in The weighting coefficients represent the semantic relevance of the evidence to the query. The weighting coefficients for the consistency between evidence and cluster centers. This is a weighting coefficient for the credibility of the evidence source. The weighting coefficients for near-repetition penalties. The weighting coefficient for penalties related to time-limited expiration; S5-2: Within a cluster, by weight Selecting Top- in descending order Evidence for achieving a cross-cluster sub-module optimization function that maximizes coverage and redundancy control:
[0022] in For the final selected subset of evidence, This is the upper limit of the final evidence set. Representing the evidence set The degree of coverage of key elements and reasoning paths in the answer, i.e. How much of the evidence in the answer covers the core statements and chain of argumentation in the answer? Representing the evidence set The degree of redundancy in the similarity between various pieces of evidence, i.e., the proportion of repetition of similar evidence. To balance coverage and redundancy control; S5-3: By optimizing the sub-modules, a purified high-quality evidence set is obtained. .
[0023] Preferably, in step S6, the multi-criteria stopping mechanism is as follows: The iteration terminates when any of the following conditions are met: (1) Quality meets standards: , For dynamic quality thresholds;
[0024] in Based on the basic quality threshold, To query the information content weighting coefficient, It represents the sum of the inverse document frequencies of all terms in the query (a measure of the information density of the query). The query length penalty coefficient, The number of tokens queried. For the numbered direct reward coefficient, I 编号 This is an indicator function; it returns 1 if the query contains a number, and 0 otherwise. (2) Insufficient marginal returns: In two consecutive iterations , The preset marginal revenue threshold; (3) Maximum number of rounds: , The maximum number of rounds is preset; (4) Delay budget: , This is the preset maximum latency limit.
[0025] Preferably, step 7 includes the following steps: enforcing inline citations in the final answer generation, and appending formatted clause citations after each key assertion. ,in As a unique identifier for the terms of evidence in the original document, The effective date of this clause, This citation format ensures that each answer statement is traceable to the specific clause and its expiration date, specifying the clause's expiration date. The generated answers are subjected to conflict detection. The detection process includes: (1) Numerical conflict detection: By comparing the numerical values appearing in different pieces of evidence under the same topic, the ratio of their range to median is calculated. If it exceeds the preset threshold, it is determined to be a numerical conflict. (2) Validity conflict detection: compare the effective and expiration times of different versions of evidence. If the same clause has contradictory provisions in different versions, it is determined to be a validity conflict. When a numerical or time-related conflict is detected, the conflict alert module is activated to list the evidence of the conflict and its corresponding numerical or time-related information, so that users can understand the scope of application of the answer and the version differences.
[0026] 1. Preferably, it also includes a training and calibration step S8, comprising: Step S2 involves training a suspiciousness discriminator: based on binary labels constructed from manually labeled data or system playback logs, and by optimizing the cross-entropy loss function. By minimizing the difference between the model's predicted probability and the true distribution, the discriminator can accurately distinguish between suspicious and normal behavior. Training the policy selector in step S3: placing it under the immediate reward function Optimization is guided within a learning framework to maximize long-term cumulative returns through action strategies, among which... Quantified the actions The resulting performance gains The cost of this action was estimated, and the hyperparameters... This is used to balance performance improvement and cost control; Weight learning is performed on step S5: An evidence cleansing weight mechanism is introduced to evaluate and calibrate the credibility of different evidence sources, thereby effectively suppressing the interference of noise or unreliable evidence and ensuring that subsequent decisions are based on cleaned, high-quality evidence information. Perform parameter calibration in step S6: Use probability calibration technology to make the probability values output by the model more accurately reflect the certainty of its prediction, thereby enhancing the reliability of the entire system.
[0027] One of the above technical solutions has the following advantages or beneficial effects: 1. This method can automatically identify quality defects in answers and trigger corresponding error correction processes through a ternary confidence assessment and suspiciousness discrimination mechanism, forming a closed-loop quality control mechanism of "detecting suspiciousness → adaptive re-retrieval → evidence cleansing → iterative optimization". This automatic error correction capability significantly reduces the generation of hallucinatory content, greatly improves the accuracy of answers, and completely changes the passive mode of traditional RAG methods that rely on one-time retrieval.
[0028] 2. An adaptive strategy selection mechanism dynamically chooses Rewrite, Expand, or Denoise strategies based on different suspicion types, avoiding the blindness and inefficiency of fixed strategies. The strategy selector achieves an optimal balance between accuracy improvement and cost control based on a quantitative trade-off between expected benefits and latency costs. This mechanism effectively reduces average response latency, meets service level agreement requirements while improving quality, and avoids unnecessary waste of computing resources.
[0029] 3. The evidence purification and time-weighted ranking process systematically eliminates interference from near-duplication, low-credibility, and time-sensitive evidence through similarity clustering, comprehensive weight evaluation, and sub-module optimization. Time-sensitive interval modeling and expired evidence eviction ensure the validity of all citations at the query time, significantly reducing expired citation issues, greatly increasing the information density of the evidence set, and providing high-quality factual support for generating answers.
[0030] 4. The mandatory inline citation mechanism adds formatted clause references and timeliness annotations to each key assertion, achieving full traceability and timeliness transparency of the answer's source. When version conflicts exist, the conflict alert module automatically lists the conflict evidence and its timeliness information, enabling users to accurately understand the scope of application of the information. This verifiability design significantly improves auditing efficiency and greatly enhances the credibility of professional document Q&A.
[0031] 5. A multi-criteria stopping mechanism combines quality achievement, marginal benefits, round limits, and time delay budgets to avoid excessive iteration and resource waste. The quantitative assessment using the confidence score F provides an objective basis for iteration termination, ensuring timely stopping after the expected quality goals are met, thus achieving an organic unity between quality assurance and cost control. This intelligent stopping mechanism effectively prevents the accumulation of time delays caused by ineffective iterations.
[0032] 6. A rigorous timeliness modeling and version conflict detection mechanism ensures time consistency, guaranteeing that the referenced information in the generated answers is fully valid at the specified point in time. This mechanism is particularly suitable for dynamically updated regulatory documents, accurately identifying and handling clause changes between different versions, and avoiding compliance risks caused by referencing outdated information.
[0033] 7. This method has no special dependencies on the underlying retrieval and generation models, possesses good versatility and pluggability, and can be flexibly integrated into existing RAG pipelines. The parameterized strategy library and modular evidence cleansing process support customized configurations according to different application scenarios, applicable to various professional document question-and-answer scenarios such as legal provisions, technical standards, and corporate regulations. It significantly reduces manual review costs while improving answer quality, demonstrating significant technical value and broad application prospects. Attached Figure Description
[0034] Figure 1 This is a flowchart of one embodiment of the method proposed in this invention. Detailed Implementation
[0035] Embodiments of the present invention are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and should not be construed as limiting the present invention.
[0036] The following is combined with Figure 1 The flowchart describes an adaptive re-retrieval and evidence cleansing error-correcting RAG method according to an embodiment of the present invention, including the following steps: S1: Receive query Q and candidate documents The set of evidence is obtained by performing the initial RAG process on query Q and employing a hybrid retrieval strategy of sparse retrieval and vector retrieval. And generate a draft Calculate the retrieval margin Coverage Generate consistency The ternary confidence scores are used to obtain the fusion confidence score: ; Where α,β,γ>0 satisfy α+β+γ=1, F0∈[0,1] represents the comprehensive quality score, which is used as the quality assessment benchmark.
[0037] S2: Construct a multidimensional suspiciousness feature vector Calculate the suspicion score: ; in For the sigmoid function, and These are the parameters obtained through training with preset parameters. This indicates the degree of doubt surrounding the answer; a higher value indicates a more serious problem with the answer's quality. Based on suspicion score and initial fusion confidence score Set a trigger condition to determine whether to start the re-retrieval process: the trigger condition is Sus≥τ sus Or F0 < τ qua (Q), where τ sus τ is the threshold for the suspicion score. qua (Q) is a dynamic quality threshold based on query features, used to adaptively adjust the strictness of the triggering conditions. When either of these two conditions is met, the system automatically triggers step S3; when the triggering conditions are not met, i.e., Sus < τ, the system automatically triggers the execution of step S3. sus And F0≥τ qua (Q) Then directly execute step S7 and output the initially generated draft A0 as the final answer; S3: Select the optimal strategy using the contextual Bandit framework:
[0038] in For the first The optimal strategy for round selection, where A is the set of strategies. , Let C(a) be the expected reward of executing strategy a, and let C(a) be the time delay cost of executing strategy a. This is the latency trade-off coefficient, used to balance the trade-off between benefits and latency; S4: Based on the selected strategy Perform the corresponding re-retrieval operation to obtain the expanded evidence pool: ; S5: Perform similarity clustering on the expanded evidence pool, calculate the comprehensive purification weight, and obtain the purified evidence set through intra-cluster selection and cross-cluster coverage optimization. ; S6: Based on a purified evidence set Regenerate Draft Recalculate the ternary confidence level With fusion score The iteration is terminated by a multi-criteria stopping mechanism. If it is terminated, step S7 is executed; otherwise, step S3 is returned. S7: Regarding the final answer A final Enforce inline citations and apply them to the final answer A. final Perform conflict detection and output verifiable results; where the final answer is A. final Draft A corresponding to satisfying the stopping condition in step S6 t+1Verifiable results include: the final answer text with formatted clause references §clause_id|eff=YYYY-MM-DD|exp=YYYY-MM-DD, and a conflict detection report. If numerical or time-related conflicts are detected, the conflict evidence and its corresponding numerical or time-related information are listed, ensuring complete traceability and time-related transparency of the answer.
[0039] Specifically, the strategy selector is based on the context features of the current iteration round. To make predictions, among which It integrates query Q and the current evidence set. and the current answer The policy selector predicts the expected payoff and cost of each policy based on multidimensional information. The expected payoff is approximated as... , indicating the execution strategy Afterwards, the fusion confidence score from the first It's the turn of the first The expected improvement of the wheel, at a cost approximately equal to... This represents an estimate of the additional latency incurred by implementing this strategy; In step S3, the strategy library The Rewrite strategy generates query rewrite variants. This includes synonym replacement, numbering normalization, and key entity expansion; the Expand strategy increases the number of recalled items. Expanding the time window Supplementing relevant version documents to expand the search domain; implementing the Denoise strategy to perform quality filtering, eliminating near-duplicate and low-trust sources, discarding expired evidence, and prioritizing the retention of directly accessible terms by number; This method automatically identifies quality defects in answers and triggers corresponding error correction processes through a ternary confidence assessment and suspiciousness discrimination mechanism, forming a closed-loop quality control mechanism of "detecting suspiciousness → adaptive re-retrieval → evidence purification → iterative optimization". This automatic error correction capability significantly reduces the generation of hallucinatory content, greatly improves answer accuracy, and completely changes the passive mode of traditional RAG methods that rely on one-time retrieval. Through ternary confidence (Δ, C, U) and suspiciousness feature vectors, the system can, like a human expert, quantitatively assess the "uncertainty" of preliminary answers, proactively identifying "high-risk" answers that may contain factual errors, incomplete information, or logical contradictions; fundamentally reducing the probability of outputting incorrect answers, and realizing the transformation from "passive error correction" to "proactive error prevention".
[0040] An adaptive strategy selection mechanism dynamically chooses Rewrite, Expand, or Denoise strategies based on different types of suspicion, avoiding the blindness and inefficiency of fixed strategies. The strategy selector achieves an optimal balance between accuracy improvement and cost control based on a quantitative trade-off between expected benefits and latency costs. This mechanism effectively reduces average response latency, meets service level agreement requirements while improving quality, and avoids unnecessary waste of computational resources. When the system determines that the answer quality may be poor, it does not simply re-retrieve, but intelligently selects the optimal correction path from strategies such as query rewriting, search expansion, and evidence denoising through the contextual Bandit framework. This avoids the limitations of a single strategy and enables the most effective corrective measures for different problems and failure modes (such as poor query wording, insufficient search scope, and high evidence noise), greatly improving the efficiency and success rate of correction.
[0041] In S5, by performing similarity clustering and comprehensive cleansing weight calculation on the extended evidence, the system achieves "refining the crude and eliminating the false." Clustering avoids duplication of similar evidence from the same source, and cross-cluster coverage ensures that the answer is supported from multiple angles and dimensions, avoiding one-sided information. Through weight calculation, the most relevant and authoritative evidence takes the lead in the final generation. This step significantly improves the quality of the "raw materials" used to generate the answer.
[0042] The entire method (S2-S6) forms an iterative closed loop. The system continuously evaluates the quality of the newly generated answer. If it does not meet the standards, it will re-enter the correction loop until the multi-criteria stopping mechanism is met. This enables the system to handle very complex problems that require multi-step reasoning, has the ability to continuously self-optimize, and is more robust to various difficult queries.
[0043] This method has no special dependencies on the underlying retrieval and generation models, possesses good versatility and pluggability, and can be flexibly integrated into existing RAG pipelines. The parameterized strategy library and modular evidence cleansing process support customized configurations for different application scenarios, making it suitable for various professional document question-and-answer scenarios such as legal provisions, technical standards, and corporate policies. It significantly reduces manual review costs while improving answer quality, demonstrating significant technical value and broad application prospects.
[0044] Furthermore, in step S1: In sparse retrieval, the BM25 model is used to calculate query Q and candidate document D. i term matching score sparse (Q,D i This score is used for the initial recall of the sparse retrieval channel, retaining the Top-K1 candidate documents with the highest term matching scores; In vector retrieval, a late interaction model is used to combine query Q and candidate documents D. i Encode the data as a token-level vector sequence, and calculate the semantic similarity score using MaxSim operations. sparse (Q,D i This similarity is used for the initial recall of the vector retrieval channel, retaining the Top-K2 candidate documents with high semantic similarity; The candidate results from the two search channels are fused, with the candidate results from the sparse search channel being based on the term matching score. sparse The top-K1 candidate documents recalled by (Q,Di) are the candidate results of the vector retrieval channel based on semantic similarity score. sparse (Q,Di) is the top-K2 candidate document sets recalled. The fusion method is to take the union of the two candidate document sets to obtain the candidate document set D'={Di}. For each document Di in the fused candidate document set D', the query Q is compared with the candidate document D using a cross encoder. i Perform pairing and calculate the relevance score of each pair. (Q,D i ), correlation score (Q,D i After normalization, the range is between [0,1]. Relevance score (Q,D i Sort all documents in the candidate document set D' in descending order, and select the Top-N documents as candidate evidence to obtain an ordered initial evidence set. 0 = {Di}, each piece of evidence includes a text fragment, clause ID, source, and time limit τ(Di) = [t eff ,t exp ), where t eff For the effective date, t exp The expiration date is the query time. Then the evidence is valid.
[0045] Specifically, the late-interaction model uses ColBERT, and the difference between the late-interaction model and the early-interaction model is that the early-interaction model calculates similarity at the overall representation level, while the late-interaction model performs token-by-token matching at the token level. Implementation, in which These are the token vectors for the query and the document, respectively. Number of tokens. Relevance score. After normalization, the range is... Between these values, a larger value indicates a stronger semantic and logical relevance between the query and the document.
[0046] BM25, like sparse retrieval, excels at capturing keywords, entities, and specific terms based on precise term matching. For queries containing specific names, abbreviations, or technical terms, it efficiently finds documents containing these exact words, ensuring basic relevance and effectively handling queries and documents using the exact same keywords; it boasts high accuracy and interpretability. Late-interaction models, such as ColBERT's vector retrieval, perform deep semantic matching. Through token-level vectors and MaxSim operations, it understands semantic similarity, such as between "computer" and "computer," finding documents even if the original word in the query does not appear in the document. This solves the problems of synonyms and semantic associations, significantly improving retrieval recall and uncovering hidden evidence highly relevant to the query intent but expressed differently. This invention combines both approaches, merging the results of lexical and semantic matching; achieving a combination of "breadth" and "depth." It avoids missing semantically relevant documents due to rigid adherence to literal matching, and also avoids ignoring strongly relevant documents containing keywords due to reliance solely on semantics, significantly improving the overall performance and robustness of the retrieval system and enabling it to handle various complex and diverse query expressions.
[0047] After the initial fusion, a more computationally intensive but more accurate cross-encoder is used to perform pairwise deep interaction scoring on candidate documents. This more accurately determines the deep relevance between queries and documents, ensuring that they ultimately enter the initial evidence set. The documents are not only potentially relevant, but highly relevant. This provides a foundation for generating high-quality drafts for subsequent LLM projects. It laid the most solid foundation.
[0048] Clause ID and Source: Each piece of evidence is assigned a unique identifier and source, ensuring traceability and auditability. When cited inline in the final answer (S7), it precisely points to the specific clause, greatly enhancing the credibility and verifiability of the answer. Validity Period The time frame of this piece of evidence is clearly recorded to ensure its accuracy, and the time of inquiry is determined by this. Is it in Within the specified range, the system can automatically filter out evidence that has expired or has not yet taken effect.
[0049] Furthermore, the retrieval margin ;in To score by relevance The relevance scores of the first two pieces of evidence, ranked in descending order (i.e., the first and second ranked pieces of evidence). These are the average scores for the positive and negative evidence sets, respectively. For the weighting factor; based on Generate initial answer The generation process is as follows: query With the initial set of evidence The evidence text is concatenated to form a prompt word input large language model (LLM). The LLM then outputs the initial answer based on this prompt word through an autoregressive generation method. Coverage ,in This is the feature extraction function. For the weighting factor; Generate Consistency
[0050] in For the set of key statements, Score NLI Let SelfAgree be the set of answer reference declarations, and SelfAgree be the self-consistency score. This is a weighting factor.
[0051] Specifically, the retrieval margin Δ assesses the robustness of the evidentiary base and measures the quality of the retrieval results on two levels. First, the Top-2 evidence gap: if the scores of the top two pieces of evidence are similar, it may indicate that the query itself is ambiguous or that there are multiple competing answers to the question, which is a significant risk signal. A high margin score suggests that the generated answer has a solid, uncontroversial foundation, reducing the risk of confusion caused by contradictions between pieces of evidence. Second, the positive-negative evidence set gap: this measures the cohesion and discriminative power of the entire evidence set, assessing the quality gap between supporting evidence (positive set) and non-supporting / weakly relevant evidence (negative set). A large gap indicates that the retrieval system can clearly distinguish between relevant and irrelevant information, suggesting that the retrieval results are not ambiguous but clear. This indicates that the evidence used for generation... It is of high quality, and in stark contrast to a large amount of low-quality information, it provides a “clean” context for LLM, reducing the possibility of being skewed by noise.
[0052] Query element coverage , The measurement ensures that the generated answer is strictly based on the provided evidence, guaranteeing that no information is lost or added out of thin air in the "query -> evidence -> answer" chain.
[0053] NLI rating Using a natural language reasoning model, we quantitatively assess whether each key piece of evidence e logically implies the answer A0. The consistency of self-consistency is assessed by verifying whether all actively provided citations in the answer can be found in the original text within the evidence set. We assess whether all the citations actively provided in the answers can be found in the original text within the evidence set.
[0054] These three metrics, Δ, C, and U, along with their fused confidence score F0, together constitute a powerful quality perception system. They reveal various failure modes that may occur in the RAG process from different perspectives (insufficient evidence, fuzzy retrieval, model illusion, logical errors, false references, etc.). Through this ternary confidence system, the system is no longer a black box but possesses self-diagnostic capabilities, accurately locating problems and providing valuable decision-making basis for the selection of subsequent adaptive re-retrieval strategies, such as Rewrite, Expand, and Denoise in S3. This is the core of achieving "error-correcting" and "adaptive" RAG.
[0055] Furthermore, in step S2, the multidimensional suspicious feature vector Features include: no-evidence indicator Low coverage Version conflict ,in For query time constraints; path inconsistency Numerical conflict This represents the ratio of the range to the median within the same unit. The above features together constitute the suspicious feature vector. This vector serves as the input to the suspiciousness discriminator in step S2, used to calculate the suspiciousness score. .
[0056] The functions of each feature are as follows: (1) No evidence indicator This is used to detect whether the initial retrieval has completely failed (no evidence was recalled), in which case the reliability of the answer is extremely low; (2) Low coverage This is used to measure the degree to which evidence does not adequately cover the query; the higher the value, the worse the match between the evidence and the query. (3) Version conflict This is used to detect the proportion of expired or time-sensitive evidence; the higher the value, the more serious the timeliness problem. (4) Path inconsistency Used to detect the degree of contradiction between reasoning paths between pieces of evidence; the larger the value, the more obvious the logical conflict between the pieces of evidence. (5) Numerical conflict It is used to detect the degree of dispersion of numerical values under the same topic in evidence. The larger the value, the more serious the numerical contradiction.
[0057] Furthermore, in step S3, the strategy selection is first based on the contextual features of the current iteration round. To make predictions, among which It integrates query Q and the current evidence set. and the current answer Multidimensional information, prediction strategy library The expected returns and costs of each strategy are given, with the expected returns approximated as follows: The cost is approximately This indicates the estimated additional latency incurred by implementing this strategy.
[0058] Specifically, the decision-making process no longer relies on fixed rules (such as "expand the search if the suspicion is high"), but is based on a dynamic and information-rich contextual feature. The system can distinguish between "retrieval failures due to unclear query descriptions" and "generation errors due to excessive evidence noise." For the former, the optimal strategy might be Rewrite; for the latter, it might be Denoise. This avoids a one-size-fits-all approach and greatly improves correction efficiency. As the iteration round t progresses, the context changes, and the decision changes accordingly. For example, the first round might choose Expand to cast a wide net, while the second round might choose Denoise to refine based on new evidence. The core action of the system, choosing a strategy, is based on the prediction of future returns ΔF(a), rather than a simple reaction to past performance. The system acts like a skilled chess player, able to anticipate the improvements that different strategies might bring. (This improvement) enables it to choose the most promising optimization path. Some strategies may not yield significant short-term gains (such as Rewrite), but they lay a solid foundation for subsequent steps; the predictive model can assess this long-term value; the expected return ΔF(a) and cost C(a) are predicted by the model, meaning they can be trained and optimized using historical interaction data. As usage time increases, this decision-making center becomes increasingly intelligent and adept at selecting the most effective correction strategies for different types of problems, forming a self-reinforcing virtuous cycle.
[0059] Furthermore, in step S4, the strategy for generating evidence through rewrite is: for each query rewrite variant... The retrieval and cross-encoder reordering are performed independently to obtain the set of retrieval results corresponding to the variant. Then, the retrieval results of all variants are merged to obtain the union of candidate evidence. Expanding the strategy for generating evidence: increasing the recall quota for retrieval. This means increasing the number of candidate pieces of evidence while relaxing the time constraint window. This involves expanding the timeframe of the query and supplementing it with relevant versions and associated standard documents to obtain a wider range of evidence sources. Denoise-filtered evidence strategy: Implement quality control during the candidate screening stage of retrieval: Use MinHash or HNSW nearest neighbor algorithms to detect and remove near-duplicate documents in candidate evidence, and eliminate expired evidence that does not meet timeliness requirements. Prioritize retaining high-confidence clauses that directly match the assigned number.
[0060] Specifically, the Rewrite strategy addresses retrieval failures caused by poorly worded, incomplete, or ambiguous original queries (Q). It's a form of "intelligent probing" that doesn't increase search volume but improves accuracy and diversity by optimizing the way queries are phrased, making it particularly suitable for handling vague or complex user queries. The Expand strategy addresses evidence omissions caused by overly narrow or strict search scopes. It's a "breadth-first" search that systematically relaxes various restrictions to ensure no key evidence is missed, making it particularly suitable for situations where initial search results are empty or insufficient. The Denoise strategy doesn't seek more evidence but rather "purifies" the existing evidence pool, eliminating low-quality and harmful information—a "quality-first" cleansing operation. Through deduplication, timeliness filtering, and authority optimization, it ensures the evidence set input to the LLM is concise, fresh, and authoritative, fundamentally reducing the risk of the LLM being misled by noise and improving the signal-to-noise ratio of the generated answer. These strategies address the three core challenges of RAG: query representation, retrieval recall, and evidence quality. They are perfectly aligned with the suspiciousness features of S2 and the Bandit decision framework of S3, thereby achieving efficient and accurate self-correction and optimization.
[0061] Furthermore, step S5 includes the following steps: S5-1: Calculate the vector embedding of each piece of evidence. Using HDBSCAN or K-Means algorithms based on vector embedding Similarity clustering is performed to obtain a set of clusters. and the cluster center of each cluster For each piece of evidence Calculate the overall purification weight:
[0062] in The weighting coefficients represent the semantic relevance of the evidence to the query. The weighting coefficients for the consistency between evidence and cluster centers. This is a weighting coefficient for the credibility of the evidence source. The weighting coefficients for near-repetition penalties. The weighting coefficient for penalties related to time-limited expiration; S5-2: Within a cluster, by weight Selecting Top- in descending order Evidence for achieving a cross-cluster sub-module optimization function that maximizes coverage and redundancy control:
[0063] in For the final selected subset of evidence, This is the upper limit of the final evidence set. Representing the evidence set The degree of coverage of key elements and reasoning paths in the answer, i.e. How much of the evidence in the answer covers the core statements and chain of argumentation in the answer? Representing the evidence set The degree of redundancy in the similarity between various pieces of evidence, i.e., the proportion of repetition of similar evidence. To balance coverage and redundancy control; S5-3: By optimizing the sub-modules, a purified high-quality evidence set is obtained. .
[0064] Specifically, the evidence cleansing and time-weighted ranking process systematically eliminates interference from near-duplication, low-credibility, and time-sensitive evidence through similarity clustering, comprehensive weight evaluation, and sub-module optimization. Time-sensitive interval modeling and expired evidence eviction ensure the validity of all citations at the query time, significantly reducing expired citation issues, greatly increasing the information density of the evidence set, and providing high-quality factual support for generating the answer. The final result... It is a set of evidence that has been refined and distilled, separating truth from falsehood. It is not merely "relevant," but also authoritative, fresh, diverse, and concise. Inputting such an evidence set into LLM lays a solid foundation for high-quality generation, greatly reducing the cognitive load on LLM and making it easier to generate factually accurate and logically clear answers; it suppresses the illusions of LLM because every major part of the answer is supported by high-quality, explicit evidence; and it enhances the coherence and comprehensiveness of the answer because the evidence itself has been clustered and optimized, implicitly containing a sound argumentative structure.
[0065] Furthermore, in step S6, the multi-criteria stopping mechanism is as follows: The iteration terminates when any of the following conditions are met: (1) Quality meets standards: , For dynamic quality thresholds;
[0066] in Based on the basic quality threshold, To query the information content weighting coefficient, It represents the sum of the inverse document frequencies of all terms in the query (a measure of the information density of the query). The query length penalty coefficient, The number of tokens queried. For the numbered direct reward coefficient, I 编号This is an indicator function; it returns 1 if the query contains a number, and 0 otherwise. (2) Insufficient marginal returns: In two consecutive iterations , The preset marginal revenue threshold; (3) Maximum number of rounds: , The maximum number of rounds is preset; (4) Delay budget: , This is the preset maximum latency limit.
[0067] The specific stopping criteria are: quality meets the standards: The fusion confidence score reaches or exceeds the dynamic quality threshold. The iteration then terminates; the initiation of the re-retrieval process is not fixed but depends on the dynamic quality threshold. For simple and clear questions, the threshold is higher, making it less likely to trigger a re-search; for complex and ambiguous questions, the threshold is lower, making it easier to initiate the correction process.
[0068] Insufficient marginal returns: in two consecutive iterations The fusion confidence score improvement between adjacent rounds is insufficient. Marginal revenue threshold: This indicates that iteration will terminate if the continued iteration yields minimal returns; Maximum number of iterations: The number of iterations has reached the preset maximum number of iterations. Then terminate the iteration; time delay budget: The cumulative latency is within the budget and does not exceed the maximum latency limit. The iteration terminates upon reaching the target; the multi-criteria stopping mechanism combines quality achievement, marginal benefits, round limits, and time delay budgets to avoid excessive iteration and resource waste. The quantitative assessment using the fusion confidence score F provides an objective basis for iteration termination, ensuring timely stopping after the expected quality goals are met, thus achieving an organic unity between quality assurance and cost control. This intelligent stopping mechanism effectively prevents the accumulation of time delays caused by ineffective iterations.
[0069] Furthermore, step 7 includes the following steps: enforcing inline citations in the final answer generation, appending formatted clause citations after each key assertion. ,in As a unique identifier for the terms of evidence in the original document, The effective date of this clause, This citation format ensures that each answer statement is traceable to the specific clause and its expiration date, specifying the clause's expiration date. The generated answers are subjected to conflict detection. The detection process includes: (1) Numerical conflict detection: By comparing the numerical values appearing in different pieces of evidence under the same topic, the ratio of their range to median is calculated. If it exceeds the preset threshold, it is determined to be a numerical conflict. (2) Validity conflict detection: compare the effective and expiration times of different versions of evidence. If the same clause has contradictory provisions in different versions, it is determined to be a validity conflict. When a numerical or time-related conflict is detected, the conflict alert module is activated to list the evidence of the conflict and its corresponding numerical or time-related information, so that users can understand the scope of application of the answer and the version differences.
[0070] Specifically, the formatted clause citation ensures that every answer statement is traceable to a specific clause and its expiration date. The time consistency guarantee mechanism, through rigorous expiration modeling and version conflict detection, ensures that the cited information in the generated answer is fully valid at the specified point in time. This mechanism is particularly suitable for dynamically updated regulatory documents, accurately identifying and handling clause changes between different versions, avoiding compliance risks caused by citing outdated information. The mandatory inline citation mechanism adds formatted clause citations and expiration date annotations to each key assertion, achieving complete traceability and time transparency of the answer's source. When version conflicts exist, the conflict alert module automatically lists the conflict evidence and its expiration date, enabling users to accurately understand the scope of application of the information. This verifiability design significantly improves audit efficiency and greatly enhances the credibility of professional document Q&A. Before the final output, key statements in the answer are required to be linked to specific sources in the cleansed evidence set and undergo conflict detection. Users or developers can easily trace back to the original evidence on which the generated answer is based to verify the accuracy of the answer. This greatly enhances users' trust in the system, makes the model's "thinking" process transparent, and helps to locate the root cause of errors and iterate the system.
[0071] Furthermore, it also includes training and calibration steps S8, including: Step S2 involves training a suspiciousness discriminator: based on binary labels constructed from manually labeled data or system playback logs, and by optimizing the cross-entropy loss function. By minimizing the difference between the model's predicted probability and the true distribution, the discriminator can accurately distinguish between suspicious and normal behavior. Training the policy selector in step S3: placing it under the immediate reward function Optimization is guided within a learning framework to maximize long-term cumulative returns through action strategies, among which... Quantified the actions The resulting performance gains The cost of this action was estimated, and the hyperparameters... This is used to balance performance improvement and cost control; Weight learning is performed on step S5: An evidence cleansing weight mechanism is introduced to evaluate and calibrate the credibility of different evidence sources, thereby effectively suppressing the interference of noise or unreliable evidence and ensuring that subsequent decisions are based on cleaned, high-quality evidence information. Perform parameter calibration in step S6: Use probability calibration technology to make the probability values output by the model more accurately reflect the certainty of its prediction, thereby enhancing the reliability of the entire system.
[0072] Specifically, the system's training and calibration process involves the collaborative optimization of multiple core components. The training of the suspiciousness discriminator is initially based on binary labels constructed from manually labeled data or system replay logs, with the core being the optimization of the cross-entropy loss function. The specific form of the loss function is as follows: The aim is to minimize the difference between the model's predicted probabilities and the true distribution, thereby ensuring that the discriminator can accurately distinguish between suspicious and normal behavior.
[0073] The policy selector is optimized within a reinforcement learning framework, with the goal of learning an action policy that maximizes long-term cumulative rewards. This optimization process is driven by a carefully designed immediate reward function. The guidance, among which Quantified the actions The resulting performance gains The cost of this action was estimated, and the hyperparameters... This is used to balance performance improvement and cost control.
[0074] To enhance the robustness of system decision-making, we introduce an evidence sanitization weight mechanism. The main function of this weight is to evaluate and calibrate the credibility of different evidence sources, minimizing L2 loss or contrastive loss through supervised learning, thereby effectively suppressing the interference of noise or unreliable evidence and ensuring that subsequent decisions are based on sanitized, high-quality evidence.
[0075] Finally, the system's key parameter set The optimal value was determined by performing a grid search on an independent validation set. To further improve the confidence of the model's output probability, probability calibration techniques, such as Platt scaling or temperature scaling, were also employed, making the probability values output by the model more accurately reflect the determinism of its predictions, thereby enhancing the reliability of the entire system.
[0076] The above technical solutions achieve a systematic improvement in the quality and timeliness of answers through a closed loop of "initial assessment - suspicious detection - strategy selection - re-retrieval execution - evidence purification - iterative optimization - verifiable output - model training".
[0077] Other configurations and operations of the adaptive re-retrieval and evidence cleansing error-correcting RAG method according to embodiments of the present invention are known to those skilled in the art and will not be described in detail here.
[0078] In the description of this specification, references to terms such as "embodiment," "example," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of the invention. In this specification, illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples.
[0079] 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. An adaptive re-retrieval and evidence sanitization error-correcting RAG method, characterized in that: Includes the following steps: S1: Receive query Q and candidate documents The set of evidence is obtained by performing the initial RAG process on query Q and employing a hybrid retrieval strategy of sparse retrieval and vector retrieval. And generate a draft Calculate the retrieval margin Coverage Generate consistency The ternary confidence scores are used to obtain the fusion confidence score: ; Where α,β,γ>0 satisfy α+β+γ=1, F0∈[0,1] represents the comprehensive quality score, which is used as the quality assessment benchmark. S2: Construct a multidimensional suspicious feature vector Calculate the suspicion score: ; in For the sigmoid function, and These are the parameters obtained through training with preset parameters. This indicates the degree of doubt surrounding the answer; a higher value indicates a more serious problem with the answer's quality. Based on suspicion score and initial fusion confidence score Set a trigger condition to determine whether to start the re-retrieval process: the trigger condition is Sus≥τ sus Or F0 < τ qua (Q), where τ sus τ is the threshold for the suspicion score. qua (Q) is a dynamic quality threshold based on query features, used to adaptively adjust the strictness of the triggering conditions. When either of these two conditions is met, the system automatically triggers step S3; when the triggering conditions are not met, i.e., Sus < τ, the system automatically triggers the execution of step S3. sus And F0≥τ qua (Q) If so, proceed directly to step S7 and output the initially generated draft A0 as the final answer; S3: Select the optimal strategy using the contextual Bandit framework: in For the first The optimal strategy for round selection, where A is the set of strategies. , Let C(a) be the expected reward of executing strategy a, and let C(a) be the time delay cost of executing strategy a. This is the latency trade-off coefficient, used to balance the trade-off between benefits and latency; S4: Based on the selected strategy Perform the corresponding re-retrieval operation to obtain the expanded evidence pool: ; S5: Perform similarity clustering on the expanded evidence pool, calculate the comprehensive purification weight, and obtain the purified evidence set through intra-cluster selection and cross-cluster coverage optimization. ; S6: Based on a purified evidence set Regenerate Draft Recalculate the ternary confidence level With fusion score ; The iteration is terminated by a multi-criteria stopping mechanism. If it is terminated, step S7 is executed; otherwise, step S3 is returned. S7: Regarding the final answer A final Enforce inline citations and apply them to the final answer A. final Perform conflict detection and output verifiable results; where the final answer is A. final Draft A corresponding to satisfying the stopping condition in step S6 t+1 Verifiable results include: the final answer text with formatted clause references §clause_id|eff=YYYY-MM-DD|exp=YYYY-MM-DD, and conflict detection reports.
2. The adaptive re-retrieval and evidence cleansing error-correcting RAG method according to claim 1, characterized in that: In step S1: In sparse retrieval, the BM25 model is used to calculate query Q and candidate document D. i term matching score sparse (Q,D i This score is used for the initial recall of the sparse retrieval channel, retaining the Top-K1 candidate documents with the highest term matching scores; In vector retrieval, a late interaction model is used to combine query Q and candidate documents D. i Encode the data as a token-level vector sequence, and calculate the semantic similarity score using MaxSim operations. sparse (Q,D i This similarity is used for the initial recall of the vector retrieval channel, retaining the Top-K2 candidate documents with high semantic similarity; The candidate results from the two search channels are fused, with the candidate results from the sparse search channel being based on the term matching score. sparse The top-K1 candidate documents recalled by (Q,Di) are the candidate results of the vector retrieval channel based on semantic similarity score. sparse (Q,Di) is the top-K2 candidate document sets recalled. The fusion method is to take the union of the two candidate document sets to obtain the candidate document set D'={Di}. For each document Di in the fused candidate document set D', the query Q is compared with the candidate document D using a cross encoder. i Perform pairing and calculate the relevance score of each pair. Relevance score After normalization, the range is between [0,1]. Relevance score Sort all documents in the candidate document set D' in descending order, and select the Top-N documents as candidate evidence to obtain an ordered initial evidence set E0={Di}. Each piece of evidence contains a text fragment, clause ID, source, and time limit τ(Di)=[t eff ,t exp ), where t eff For the effective date, t exp The expiration date is the query time. Then the evidence is valid.
3. The adaptive re-retrieval and evidence cleansing error-correcting RAG method according to claim 2, characterized in that: Search margin ;in To score by relevance The relevance scores of the first two pieces of evidence, ranked in descending order (i.e., the first and second ranked pieces of evidence). These are the average scores for the positive and negative evidence sets, respectively. For the weighting factor; Initial answer generated based on E0. The generation process is as follows: query With the initial set of evidence The evidence text is concatenated to form a prompt word input large language model (LLM). The LLM then outputs the initial answer based on this prompt word through an autoregressive generation method. Coverage ,in This is the feature extraction function. For the weighting factor; Generate Consistency in For the set of key statements, Score NLI Let SelfAgree be the set of answer reference declarations, and SelfAgree be the self-consistency score. This is a weighting factor.
4. The adaptive re-retrieval and evidence cleansing error-correcting RAG method according to claim 1, characterized in that: In step S2, the multidimensional suspicious feature vector Features include: no-evidence indicator Low coverage Version conflict ,in For query time constraints; path inconsistency Numerical conflict This represents the ratio of the range to the median within the same unit. The above features together constitute the suspicious feature vector. This vector serves as the input to the suspiciousness discriminator in step S2, used to calculate the suspiciousness score. .
5. The adaptive re-retrieval and evidence sanitization error-correcting RAG method according to claim 1, characterized in that: In step S3, the strategy selection is first based on the context features of the current iteration round. To make predictions, among which It integrates query Q and the current evidence set E. t and the current answer Multidimensional information, prediction strategy library The expected returns and costs of each strategy are given, with the expected returns approximated as follows: The cost is approximately This represents the estimated additional latency incurred by implementing this strategy.
6. The adaptive re-retrieval and evidence sanitization error-correcting RAG method according to claim 1, characterized in that: In step S4, the strategy for generating evidence through rewrite is to rewrite each query variant. The retrieval and cross-encoder reordering are performed independently to obtain the set of retrieval results corresponding to the variant. Then, the retrieval results of all variants are merged to obtain the union of candidate evidence. Expanding the strategy for generating evidence: increasing the recall quota for retrieval. This means increasing the number of candidate pieces of evidence while relaxing the time constraint window. This involves expanding the timeframe of the query and supplementing it with relevant versions and associated standard documents to obtain a wider range of evidence sources. Denoise-filtered evidence strategy: Implement quality control during the candidate screening stage of retrieval: Use MinHash or HNSW nearest neighbor algorithms to detect and remove near-duplicate documents in candidate evidence, and eliminate expired evidence that does not meet timeliness requirements. Prioritize retaining high-confidence clauses that directly match the assigned number.
7. The adaptive re-retrieval and evidence cleansing error-correcting RAG method according to claim 1, characterized in that: Step S5 includes the following steps: S5-1: Calculate the vector embedding of each piece of evidence. Using HDBSCAN or K-Means algorithms based on vector embedding Similarity clustering is performed to obtain a set of clusters. and the cluster center of each cluster For each piece of evidence Calculate the overall purification weight: in The weighting coefficients represent the semantic relevance of the evidence to the query. The weighting coefficients for the consistency between evidence and cluster centers. This is a weighting coefficient for the credibility of the evidence source. The weighting coefficients for near-repetition penalties. The weighting coefficient for penalties related to time-limited expiration; S5-2: Within a cluster, by weight Selecting Top- in descending order Evidence for achieving a cross-cluster sub-module optimization function that maximizes coverage and redundancy control: in For the final selected subset of evidence, This is the upper limit of the final evidence set. Representing the evidence set The degree of coverage of key elements and reasoning paths in the answer, i.e. How much of the evidence in the answer covers the core statements and chain of argumentation in the answer? Representing the evidence set The degree of redundancy in the similarity between various pieces of evidence, i.e., the proportion of repetition of similar evidence. To balance coverage and redundancy control; S5-3: By optimizing the sub-modules, a purified high-quality evidence set is obtained. .
8. The adaptive re-retrieval and evidence sanitization error-correcting RAG method according to claim 1, characterized in that: In step S6, the multi-criteria stopping mechanism is as follows: The iteration terminates when any of the following conditions are met: (1) Quality meets standards: , For dynamic quality thresholds; ; in Based on the basic quality threshold, To query the information content weighting coefficient, It represents the sum of the inverse document frequencies of all terms in the query (a measure of the information density of the query). The query length penalty coefficient, The number of tokens queried. For the numbered direct reward coefficient, I 编号 This is an indicator function; it returns 1 if the query contains a number, and 0 otherwise. (2) Insufficient marginal returns: In two consecutive iterations , The preset marginal revenue threshold; (3) Maximum number of rounds: , The maximum number of rounds is preset; (4) Delay budget: , This is the preset maximum latency limit.
9. The adaptive re-retrieval and evidence sanitization error-correcting RAG method according to claim 1, characterized in that: Step 7 includes the following steps: Enforcing inline citations in the final answer generation, appending formatted clause citations after each key assertion. ,in As a unique identifier for the terms of evidence in the original document, The effective date of this clause, This citation format ensures that each answer statement is traceable to the specific clause and its expiration date, specifying the clause's expiration date. The generated answers are subjected to conflict detection. The detection process includes: (1) Numerical conflict detection: By comparing the numerical values appearing in different pieces of evidence under the same topic, the ratio of their range to median is calculated. If it exceeds the preset threshold, it is determined to be a numerical conflict. (2) Validity conflict detection: compare the effective and expiration times of different versions of evidence. If the same clause has contradictory provisions in different versions, it is determined to be a validity conflict. When a numerical or time-related conflict is detected, the conflict alert module is activated to list the evidence of the conflict and its corresponding numerical or time-related information, so that users can understand the scope of application of the answer and the version differences.
10. The adaptive re-retrieval and evidence sanitization error-correcting RAG method according to claim 1, characterized in that: It also includes training and calibration steps S8, including: Step S2 involves training a suspiciousness discriminator: based on binary labels constructed from manually labeled data or system playback logs, and by optimizing the cross-entropy loss function. By minimizing the difference between the model's predicted probability and the true distribution, the discriminator can accurately distinguish between suspicious and normal behavior. Training the policy selector in step S3: placing it under the immediate reward function Optimization is guided within a learning framework to maximize long-term cumulative returns through action strategies, among which... Quantified the actions The resulting performance gains The cost of this action was estimated, and the hyperparameters... This is used to balance performance improvement and cost control; Weight learning is performed on step S5: An evidence cleansing weight mechanism is introduced to evaluate and calibrate the credibility of different evidence sources, thereby effectively suppressing the interference of noise or unreliable evidence and ensuring that subsequent decisions are based on cleaned, high-quality evidence information. Perform parameter calibration in step S6: Use probability calibration technology to make the probability values output by the model more accurately reflect the certainty of its prediction, thereby enhancing the reliability of the entire system.
Citation Information
Cited By
A method and system for generating and self-evolving dynamic prompts tailored to each user in recommendation scenarios.
CN122133812A