Search enhancement generation method and apparatus, electronic device, and storage medium

CN123030762APending Publication Date: 2026-11-03HUAGONG TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611193174.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-07
Publication Date
2026-11-03

AI Technical Summary

Technical Problem

Existing RAG technology suffers from uncontrollable context length and accumulation of noise information in evidence management, affecting the quality and stability of the generated answers, and cannot effectively resolve the conflict between model parameter knowledge and external evidence.

Method used

By constructing an evidence ledger with a pre-set fixed budget, candidate evidence from multiple different knowledge sources is stored uniformly. The evidence composition is dynamically maintained through state transition operations. At the same time, conflict arbitration between model parameter knowledge and the evidence ledger is carried out to achieve optimized and stable management of evidence.

Benefits of technology

Effective control of context length avoids the accumulation of noise information, improves the quality and stability of generated answers, solves the endogenous conflict problem of old knowledge covering new external evidence, and enhances the accuracy and reliability of answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123030762A_ABST
    Figure CN123030762A_ABST
Patent Text Reader

Abstract

The application provides a retrieval enhancement generation method and device, electronic equipment and a storage medium, and relates to the technical field of artificial intelligence. The application constructs a preset fixed budget evidence account book, uniformly stores and manages candidate evidence from multiple different knowledge sources in the same state object in the form of account book entries, dynamically maintains the composition of the evidence under the constraint of the fixed budget by performing state transition operations including replacement on the account book entries, and arbitrates conflicts between model parameter knowledge and account book entries in the evidence account book. In this way, the dynamic optimization of the evidence is realized through the state transition operation within the fixed budget, thereby effectively controlling the context length, avoiding evidence dilution caused by the accumulation of noise information, and improving the quality and stability of the generated answer. At the same time, by arbitrating conflicts between model parameter knowledge and external evidence, the accuracy and reliability of the answer are further improved.
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 in particular to a search enhancement generation method, apparatus, electronic device, and storage medium. Background Technology

[0002] RAG (Retrieval-Augmented Generation) technology enhances the answering capabilities of large language models by introducing external knowledge bases, and has been widely used in scenarios such as knowledge question answering and document understanding.

[0003] However, existing RAG technology has the following shortcomings in evidence management: when processing retrieved evidence, existing methods usually use simple splicing or appending to expand the evidence input into the generation model; when the quality of the search results is poor or there are conflicts between the evidence, they often try to compensate by continuously expanding the context window, which leads to uncontrollable context length, accumulation of noise information, and thus affects the quality and stability of the generated answer. Summary of the Invention

[0004] The purpose of this invention is to provide a retrieval enhancement generation method, apparatus, electronic device, and storage medium to alleviate the problems of uncontrollable context length and noise information accumulation in the prior art, which affect the quality and stability of the generated answers.

[0005] In a first aspect, the present invention provides a retrieval enhancement generation method, comprising: In response to a user's query request, candidate evidence is obtained from a pre-defined knowledge base; Based on candidate evidence, an evidence ledger with a preset fixed budget is constructed. The evidence ledger is used to uniformly store candidate evidence from multiple different knowledge sources in the same state object in the form of ledger entries through a predetermined number of slots. During the maintenance of the evidence ledger, state transition operations, including replacement, are performed on the ledger entries to maintain the evidence composition in the evidence ledger under the constraint of the preset fixed budget. Arbitrate the conflict between the model parameter knowledge corresponding to the query request and the ledger entries in the evidence ledger; Based on the evidence ledger following the conflict arbitration, the target answer corresponding to the query request is generated.

[0006] In an optional implementation, in response to a user's query request, candidate evidence is obtained from a preset knowledge base, including: Based on the feature information in the query request, the query complexity score, conflict risk score, and timeliness requirement score are calculated; among them, the feature information includes at least one of the following: number of entities, number of relation words, number of constraint words, time words, version words, and specification update indications; Based on the query complexity score, conflict risk score, and timeliness requirement score, at least one target retrieval path is adaptively selected from multiple candidate retrieval paths. The target retrieval path is used to search the preset knowledge base, and the retrieval results are used as candidate evidence.

[0007] In an optional implementation, the preset knowledge base includes multiple semantic blocks and their block signatures generated from the original knowledge base documents, as well as dense vector indexes, sparse lexical indexes, block signature indexes, and lightweight relational graph indexes built based on the block signatures; multiple candidate retrieval paths include text retrieval paths based on dense vector indexes and sparse lexical indexes, graph retrieval paths based on lightweight relational graph indexes, and version index filtering paths based on block signature indexes; based on query complexity scores, conflict risk scores, and timeliness requirement scores, at least one target retrieval path is adaptively selected from the multiple candidate retrieval paths, and a retrieval is performed in the preset knowledge base through the target retrieval path, with the retrieval results used as candidate evidence, including: Determine whether the timeliness requirement score is lower than the preset timeliness threshold; If the timeliness requirement score is lower than the timeliness threshold, then determine whether the query complexity score is not lower than the preset first complexity threshold or whether the conflict risk score is not lower than the preset first risk threshold. If the query complexity score is not lower than the first complexity threshold or the conflict risk score is not lower than the first risk threshold, then both the text retrieval path and the graph retrieval path are selected, and the retrieval results of both are used as candidate evidence. If the query complexity score is lower than the first complexity threshold and the conflict risk score is lower than the first risk threshold, then determine whether the query complexity score is lower than the preset second complexity threshold and whether the conflict risk score is lower than the preset second risk threshold. If the query complexity score is lower than the second complexity threshold and the conflict risk score is lower than the second risk threshold, then the text retrieval path is selected, and the retrieval results of the text retrieval path are used as candidate evidence. If the query complexity score is not lower than the second complexity threshold or the conflict risk score is not lower than the second risk threshold, then both the text retrieval path and the graph retrieval path are selected simultaneously, and the retrieval results of the two are merged and sorted as candidate evidence. If the timeliness requirement score is not lower than the timeliness threshold, then the candidate block is filtered by the version index filtering path, and the steps of judging whether the query complexity score is not lower than the preset first complexity threshold or the conflict risk score is not lower than the preset first risk threshold are executed.

[0008] In an optional implementation, an evidence ledger with a pre-set fixed budget is constructed based on candidate evidence, including: Initialize the evidence ledger; Under the constraint of a preset fixed budget, candidate evidence is written into the corresponding slots of the evidence ledger through a budget-preserving replacement method. The budget-preserving replacement method includes replacing the non-frozen ledger entry with the lowest utility score with the high-value candidate evidence when the evidence ledger is full and there is high-value candidate evidence to be written; when the evidence ledger is full and the candidate evidence to be written is not high-value candidate evidence, replacement is only performed when the utility score of the candidate evidence exceeds the utility score of the non-frozen ledger entry with the lowest utility score in the evidence ledger by a preset range. High-value candidate evidence refers to candidate evidence that can fill the missing query features in the evidence ledger. The utility score is used to characterize the relevance, authority, timeliness, redundancy, and conflict of the candidate evidence with the query request.

[0009] In an optional implementation, the utility score is calculated based on the relevance score of the candidate evidence to the query request, the coverage of the entity relationship of the candidate evidence to the query request, the source authority of the candidate evidence, the timeliness score of the candidate evidence, the document continuity score of the candidate evidence, the redundancy of the candidate evidence with existing evidence in the evidence ledger, and the conflict degree between the candidate evidence and existing evidence in the evidence ledger.

[0010] In an optional implementation, conflict arbitration is performed between the model parameter knowledge corresponding to the query request and the ledger entries in the evidence ledger, including: Generate internal candidate answers and self-answer confidence scores for query requests using a large model; Internal candidate answers are used as model parameter knowledge and transformed into virtual ledger entries; Based on the self-answered confidence level, conflict arbitration is carried out between virtual ledger entries and ledger entries from the pre-set knowledge base in the evidence ledger; Conflict arbitration includes: Align virtual ledger entries with ledger entries from a pre-defined knowledge base and calculate the degree of factual contradiction. When the degree of factual contradiction exceeds the first preset threshold, if the timeliness and authority of the ledger entry from the preset knowledge base are both better than those of the virtual ledger entry, then the virtual ledger entry will be downgraded to a candidate answer dominated by the ledger entry from the preset knowledge base; if the timeliness or authority of the ledger entry from the preset knowledge base is not better than those of the virtual ledger entry, and the self-answer confidence level of the virtual ledger entry is greater than the preset confidence threshold, then the virtual ledger entry will be retained and marked as pending verification. When the degree of factual contradiction is less than or equal to the second preset threshold, the virtual ledger entry is merged with the ledger entry from the preset knowledge base and used together as candidate answers; When a conflict cannot be resolved using existing entries in the evidence ledger, the missing triples corresponding to the conflict are extracted, and a targeted micro-search is performed on the missing triples to supplement new ledger entries. Situations where a conflict cannot be resolved using existing entries in the evidence ledger include: a factual contradiction greater than a second preset threshold but not greater than a first preset threshold; or, a factual contradiction greater than the first preset threshold, and the timeliness or authority of the ledger entry from the preset knowledge base is not superior to the virtual ledger entry, and the self-answer confidence level corresponding to the virtual ledger entry is not greater than a preset confidence threshold. Missing triples include missing entities, missing relations, and missing times.

[0011] In an optional implementation, based on the evidence ledger following conflict arbitration, a target answer corresponding to the query request is generated, including: The entries in the evidence ledger after the conflict arbitration are transformed into claim cards, which include the claim text, supporting fragments, and source location. Based on the evidence ledger after conflict arbitration, a constraint decoding mechanism is used to generate the current answer corresponding to the query request; wherein, the constraint decoding mechanism includes binding at least one claim card to each sentence in the current answer, and when a sentence is bound to a slot containing counter-evidence, the sentence is output as a disclosure expression; The current answer is checked against preset verification indicators; these preset verification indicators include one or more of the following: coverage, proportion of unsupported sentences, completeness of conflict disclosure, and completeness of citations. When the verification fails, partial evidence replacement is performed only for the uncovered claim cards, and partial regeneration is performed only for sentences not bound to claim cards; Once the verification is successful, the current answer will be designated as the target answer.

[0012] In a second aspect, the present invention provides a retrieval enhancement generation apparatus, comprising: The evidence acquisition module is used to obtain candidate evidence from a preset knowledge base in response to user query requests; The ledger construction module is used to construct an evidence ledger with a preset fixed budget based on candidate evidence. The evidence ledger is used to uniformly store candidate evidence from multiple different knowledge sources in the same state object in the form of ledger entries through a predetermined number of slots. During the maintenance of the evidence ledger, state transition operations, including replacement, are performed on the ledger entries to maintain the evidence composition in the evidence ledger under the constraint of the preset fixed budget. The conflict arbitration module is used to arbitrate conflicts between the model parameter knowledge corresponding to the query request and the ledger entries in the evidence ledger. The answer generation module is used to generate the target answer corresponding to the query request based on the evidence ledger after conflict arbitration.

[0013] Thirdly, the present invention provides an electronic device, including a memory and a processor, wherein the memory stores a computer program that can run on the processor, and the processor executes the computer program to implement the retrieval enhancement generation method of any of the foregoing embodiments.

[0014] Fourthly, the present invention provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, performs the retrieval enhancement generation method of any of the foregoing embodiments.

[0015] The retrieval enhancement generation method, apparatus, electronic device, and storage medium provided by this invention construct an evidence ledger with a preset fixed budget. Candidate evidence from multiple different knowledge sources is uniformly stored and managed as ledger entries within the same state object. Through state transition operations, including replacement, the evidence composition is dynamically maintained under fixed budget constraints. Simultaneously, conflict arbitration is performed between model parameter knowledge and ledger entries in the evidence ledger. Compared to existing technologies, this solution does not require continuously adding search results or expanding the context window to compensate for insufficient evidence. Instead, it dynamically optimizes evidence within a fixed budget through state transition operations, effectively controlling the context length, avoiding evidence dilution caused by noise accumulation, and improving the quality and stability of the generated answer. Furthermore, by arbitrating conflicts between model parameter knowledge and external evidence, the inherent conflict problem of old parameter knowledge overwriting new external evidence is resolved, preventing the resurgence of old knowledge and further improving the accuracy and reliability of the answer. Attached Figure Description

[0016] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0017] Figure 1 A flowchart illustrating a retrieval enhancement generation method provided in an embodiment of the present invention; Figure 2 A flowchart illustrating another retrieval enhancement generation method provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of a retrieval enhancement generation device provided in an embodiment of the present invention; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0018] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. 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.

[0019] Research has revealed the following core shortcomings in existing search enhancement generation technologies regarding evidence management: I. Limitations of error-correcting and self-reflective RAGs.

[0020] Self-RAG, CRAG, and SR-RAG, representing error-correcting, self-reflective, and selective retrieval RAGs, share the common goal of dynamically adjusting retrieval behavior to improve question-answering accuracy and reduce illusions when ordinary RAGs encounter retrieval errors, context-irrelevant queries, or when the model itself possesses sufficient knowledge. Their general technical methods include: performing an initial retrieval on the user query; using a retrieval evaluator, self-reflective mechanism, or uncertainty estimation module to determine if the current retrieval results are sufficient; performing re-retrieval, expanded retrieval, query rewriting, knowledge verbalization, or multi-source selection when the retrieval is insufficient; and finally, inputting the filtered evidence into the generation model to provide an answer. The relationship between these steps is a sequential closed loop of "query-driven retrieval → retrieval quality assessment → correction when necessary → re-generation of the answer."

[0021] The shortcomings of this type of method are as follows: First, many systems still use query-level coarse-grained judgment, which can only roughly determine whether to conduct another search, but cannot finely control which evidence should be retained and which should be replaced; Second, when the system finds insufficient evidence, the common action is to continue to add context or add candidate documents again, which can easily cause context dilution; Third, it does not place model parameter knowledge, retrieved text evidence, graph structure evidence, and counter-evidence information in the same competitive framework. Therefore, in the event of knowledge conflict, version updates, or missing bridging facts, erroneous overwriting, relapse of old knowledge, or high-latency repeated calls may still occur.

[0022] II. Limitations of Graph Structure and Adaptive Routing RAG.

[0023] Structured retrieval and adaptive routing-based RAGs, represented by GraphRAG, EA-GraphRAG, A2RAG, and related GraphRAG evaluation works, share the common goal of constructing knowledge graphs, entity relationship graphs, or community summaries from documents to compensate for the shortcomings of ordinary chunk retrieval in handling global, multi-hop, and long document problems. Their general technical methods include: offline entity extraction, relation extraction, community segmentation, and summary pre-computation of the original documents to form a graph index; online complexity analysis of the problem, selecting ordinary RAG, graph retrieval, or a fusion of both based on rules or a lightweight scorer; and fusion of the retrieved graph paths, community summaries, or evidence traced back to the source text to generate the answer. The relationship between these components is represented as a chain of "graph structure database construction → complexity routing → graph-guided retrieval → text backtracking → response generation."

[0024] The shortcomings of this type of method are as follows: First, graph construction itself introduces extraction loss, as fine-grained qualifiers, time conditions, version differences, etc., usually only exist in the original text and are not fully encoded into the graph. Second, unified benchmark studies have shown that GraphRAG and ordinary RAG each have their advantages; applying graph routes to all queries can easily lead to unnecessary latency and costs for simple queries. Third, even with graph routing completed, existing methods typically lack replacement mechanisms under a fixed evidence budget and conflict arbitration mechanisms between model parameter knowledge and external evidence. Therefore, they cannot simultaneously address mixed-difficulty workloads, version conflicts, similar document confusion, and sentence-level traceability constraints. Related research results further illustrate that the signature organization method of evidence blocks and the readability of the evidence directly affect the quality of the final answer.

[0025] In summary, most existing methods enhance specific aspects: some strengthen retrieval and error correction, some enhance graph structure, some enhance knowledge source selection, and some enhance attribution or presentation. However, these methods generally lack a unified intermediate representation, failing to connect query complexity routing, fixed-budget evidence replacement, version and memory conflict adjudication, and sentence-level evidence binding into a controllable closed loop. This is the core problem that the embodiments of this invention aim to solve.

[0026] Based on this, embodiments of the present invention provide a retrieval enhancement generation method, apparatus, electronic device, and storage medium, which can solve the following problems existing in current large-scale model RAGs in scenarios involving mixed difficulty queries, rapidly evolving version knowledge bases, multi-document long-link inference, and conflicts between model parameter knowledge and external evidence: 1. Adaptive routing can only achieve mode switching, but cannot achieve unified competition of results from multiple search paths, resulting in excessively high costs for simple queries and a lack of key bridging facts for complex queries; 2. Evidence optimization can only be achieved by expanding the context, which leads to the context being diluted by noise and excessive latency fluctuations; 3. Conflict handling only addresses external multi-source evidence and cannot resolve endogenous conflicts where old knowledge about parameters overwrites new external evidence, leading to a resurgence of old knowledge. 4. The generation process lacks a fine-grained evidence binding mechanism, making it difficult to trace the basis of each sentence in the final output, resulting in insufficient auditability.

[0027] The embodiments of the present invention are applicable to application scenarios that require timeliness, accuracy, traceability and reasoning ability, such as enterprise knowledge base question and answer, legal and regulatory question and answer, software document and API question and answer, scientific research literature assisted reading, and complex multi-document retrieval question and answer.

[0028] To facilitate understanding of this embodiment, a retrieval enhancement generation method disclosed in this embodiment of the invention will first be described in detail.

[0029] This invention provides a retrieval enhancement generation method that can be executed by an electronic device with data processing capabilities. The core of this method lies not in simply overlaying GraphRAG, CRAG, or selective retrieval, but in proposing a unified intermediate state object—an evidence ledger. All knowledge sources, including model parameter knowledge, ordinary text retrieval results, graph path evidence, version records, counter-evidence information, and policy constraints, are all incorporated into the same budget-constrained, replaceable, arbitrable, and traceable unified framework in the form of ledger entries.

[0030] See Figure 1 The diagram shows a flowchart of a retrieval enhancement generation method, which mainly includes the following steps S110 to S140: Step S110: In response to the user's query request, obtain candidate evidence from the preset knowledge base.

[0031] The query request can be a text question entered by the user through an interactive interface. The pre-built knowledge base is a pre-constructed collection of structured knowledge used to store and manage searchable document data.

[0032] In some possible embodiments, step S110 may include: calculating a query complexity score, a conflict risk score, and a timeliness requirement score based on the feature information in the query request; wherein the feature information includes at least one of the following: number of entities, number of relation words, number of constraint words, time words, version words, and specification update indications; adaptively selecting at least one target retrieval path from multiple candidate retrieval paths based on the query complexity score, conflict risk score, and timeliness requirement score, performing a retrieval in a preset knowledge base through the target retrieval path, and using the retrieval results as candidate evidence.

[0033] In practice, the user's query request is first parsed to extract feature information such as the number of entities, relational terms, constraint terms, time terms, version terms, and specification update indications. Based on this feature information, three core scores are calculated using a preset formula: query complexity score, conflict risk score, and timeliness requirement score.

[0034] The query complexity score is used to determine whether graph retrieval paths should be enabled. In one possible implementation, the query complexity score can be calculated using the following formula: ; in, The normalized number of entities; The number of relational terms after normalization; The number of constraint terms for normalization; The query complexity score is the normalized query length. Finally, it is normalized to the 0-1 range. The query length can be obtained based on the number of characters in the query request or the number of tokens after word segmentation.

[0035] The conflict risk score is used to determine whether there is a conflict between the model's parameter knowledge (also known as internal candidate answers) and evidence from a pre-defined knowledge base (also known as external evidence). In one possible implementation, the conflict risk score can be calculated using the following formula: ; in, This is an indicator variable for whether a version term is included; This is an indicator variable for whether a time word is included; Indicator variables for whether a specification update is involved; conflict risk score. Normalize to the 0-1 interval.

[0036] The timeliness requirement score is used to determine whether the most recent version, validity period, or latest announcement must be prioritized. In one possible implementation, when time-related terms are present in the query request, the formula for calculating the timeliness requirement score can be: ; in, This refers to the number of days from the current time for the time term in the query request; When the query request does not contain time-related terms, the timeliness requirement score is... =0.2.

[0037] After obtaining the three core scores mentioned above, at least one target retrieval path is adaptively selected from multiple candidate retrieval paths based on these scores for retrieval. In some possible embodiments, candidate retrieval paths may include text retrieval paths, graph retrieval paths, and version index filtering paths; the preset knowledge base may include multiple semantic blocks and their block signatures generated based on the original knowledge base documents, as well as dense vector indexes, sparse lexical indexes, block signature indexes, and lightweight relational graph indexes built based on the block signatures; wherein, the text retrieval path is implemented based on dense vector indexes and sparse lexical indexes, the graph retrieval path is implemented based on lightweight relational graph indexes, and the version index filtering path is implemented based on block signature indexes. Based on this, the above-mentioned adaptive selection of target retrieval paths to obtain candidate evidence may include: Determine whether the timeliness requirement score is lower than the preset timeliness threshold; If the timeliness requirement score is lower than the timeliness threshold, then determine whether the query complexity score is not lower than the preset first complexity threshold or whether the conflict risk score is not lower than the preset first risk threshold. If the query complexity score is not lower than the first complexity threshold or the conflict risk score is not lower than the first risk threshold, then both the text retrieval path and the graph retrieval path are selected, and the retrieval results of both are used as candidate evidence. If the query complexity score is lower than the first complexity threshold and the conflict risk score is lower than the first risk threshold, then it is further determined whether the query complexity score is lower than the preset second complexity threshold and whether the conflict risk score is lower than the preset second risk threshold. If the query complexity score is lower than the second complexity threshold and the conflict risk score is lower than the second risk threshold, then the text retrieval path is selected, and the retrieval results of the text retrieval path are used as candidate evidence. If the query complexity score is not lower than the second complexity threshold or the conflict risk score is not lower than the second risk threshold, then both the text retrieval path and the graph retrieval path are selected simultaneously, and the retrieval results of the two are merged and sorted as candidate evidence. If the timeliness requirement score is not lower than the timeliness threshold, then the candidate block is filtered by the version index filtering path, and the steps of judging whether the query complexity score is not lower than the preset first complexity threshold or the conflict risk score is not lower than the preset first risk threshold are continued.

[0038] The aforementioned timeliness threshold, first complexity threshold, first risk threshold, second complexity threshold, and second risk threshold can all be set according to actual needs, and are not limited here. For example, the timeliness threshold, first complexity threshold, and first risk threshold are all 0.7, and the second complexity threshold and second risk threshold are all 0.3. When the query complexity score is greater than or equal to 0.7, it indicates that the query is relatively complex, requiring simultaneous activation of both text retrieval via the text retrieval path and graph-guided retrieval via the graph retrieval path. Graph-guided retrieval expands from the entity node through one to three hops and back to the source text. The results of both types of retrieval are input into the evidence ledger to compete. When the query complexity score is less than 0.3 and the conflict risk score is less than 0.3, it indicates that the query is relatively simple and there is no conflict risk. Only sparse-dense mixed text retrieval via the text retrieval path needs to be activated, and the retrieval results are directly input into the evidence ledger. When the query is in a boundary region (e.g., the query complexity score is greater than or equal to 0.3 and less than 0.7), the text retrieval results via the text retrieval path and the graph retrieval results via the graph retrieval path are merged and sorted, and then all are input into the ledger. When the timeliness requirement score is greater than or equal to 0.7, it indicates that the timeliness requirement is high or the query contains version / date constraints. It is necessary to first filter the block signature index of the path through the version index to find candidate blocks that meet the timeliness and version requirements, and then combine the query complexity score and conflict risk score to perform the corresponding retrieval and input the results into the ledger.

[0039] It can be explained that the core of adaptive routing in this embodiment of the invention is that the output results of all retrieval paths are uniformly input into the evidence ledger for subsequent competition, rather than a binary mode switching. Unlike the mode switching mechanism of existing technologies, the routing in this embodiment selects which retrieval path results enter the evidence ledger for competition. This ensures both the targeting of the retrieval and avoids the omission of optimal evidence due to mode switching.

[0040] It should be noted that the block signature can be a 128-dimensional structured feature vector generated for each semantic block, which may include topic tags, core noun set, entity set, timestamp or validity period, version number, source type, source authority level, continuity identifier, and original text location information, etc. For example, the block signature specifically includes the following fields and quantification rules: 1. Topic tags: a 10-dimensional topic probability distribution output by the document classification model; 2. Core noun set: a list of core entities extracted through entity extraction, converted into a 64-dimensional hash feature; 3. Timestamp / Validity period: the effective time interval corresponding to the block content, normalized to a timeliness feature in the range of 0-1; 0 indicates that the semantic block is completely invalid or expired at the current time and has no timeliness value; 1 indicates that the semantic block is completely valid or has just been released at the current time and has the highest timeliness value; 4. Version number: the version identifier of the document, converted into an integer version priority feature; 5. Source type: the source channel of the document (such as official announcements, third-party documents, or user manuals, etc.), corresponding to an authority level of 0-5; 6. Continuity identifier: the entity overlap rate between the current semantic block and the previous semantic block, used to characterize the continuity of the document flow, with a value range of 0-1.

[0041] The four types of indexes built on block signatures include: dense vector indexes, constructed from sentence vectors of semantic blocks, used for semantic similarity retrieval; sparse lexical indexes, constructed from the BM25 algorithm, used for precise lexical matching; block signature indexes, inverted indexes constructed from the structured features of block signatures, used for quickly filtering candidate blocks that meet version, timeliness, and authority requirements; and lightweight relational graph indexes, graph indexes constructed from entities and relations within blocks, used for multi-hop inference.

[0042] Step S120: Construct an evidence ledger with a preset fixed budget based on the candidate evidence.

[0043] The aforementioned evidence ledger is used to uniformly store candidate evidence from multiple different knowledge sources in the same state object using ledger entries in a predetermined number of slots. Each slot stores one ledger entry, which includes evidence identifier, source type, and original text location. During the maintenance of the evidence ledger, state transition operations, including replacement, are performed on the ledger entries to maintain the evidence composition in the evidence ledger under the constraint of a preset fixed budget.

[0044] In some possible embodiments, step S120 may include: initializing the evidence ledger; and writing candidate evidence into the corresponding slots of the evidence ledger by means of budget-preserving replacement under the constraint of a preset fixed budget.

[0045] In practical implementation, a fixed-budget evidence ledger is first initialized. The total number of slots, B, in the evidence ledger can be 6 to 12, and must include at least two of the following types: fact slots, bridging slots, version slots, and counter-evidence slots. Each ledger entry records at least: evidence identifier, source type, original text location, relevance, coverage, authority, timeliness, continuity score, contradiction, cost score, and whether it has been bound to a sentence. The source types must include at least: parametric knowledge summary, text block evidence, graph path evidence, version description evidence, and counter-evidence.

[0046] The evidence ledger is an executable state machine that supports write, replace, freeze, downgrade, backtrack, and bind operations. The evidence ledger itself is a finite state machine, and each ledger entry has one of the following states: initial, candidate, active, frozen, or downgraded. It supports the following state transition operations: 1. Write: New evidence enters the evidence ledger and is marked as a candidate; 2. Replace: Ineffective evidence is marked as downgraded, and new evidence is upgraded to active; 3. Freeze: Key bridging evidence is marked as frozen and cannot be replaced; 4. Backtrack: Downgraded evidence can be recalled when needed; 5. Bind: After evidence is bound to a generated sentence, it is marked as bound and cannot be replaced. This state machine mechanism differs from conventional software engineering paradigms and is a dedicated state transition rule designed specifically for RAG evidence management.

[0047] Under a pre-set fixed budget constraint, candidate evidence is written into the corresponding slots of the evidence ledger using a budget-preserving replacement method. This budget-preserving replacement method can include: when the evidence ledger is full and there is high-value candidate evidence to be written, replacing the non-frozen ledger entry with the lowest utility score with the high-value candidate evidence; when the evidence ledger is full and the candidate evidence to be written is not high-value candidate evidence, replacement is only performed when the utility score of the candidate evidence exceeds the utility score of the non-frozen ledger entry with the lowest utility score by a preset margin. High-value candidate evidence refers to candidate evidence that can fill missing query features in the evidence ledger; the utility score is used to characterize the relevance, authority, and timeliness of the candidate evidence to the query request, as well as its redundancy and conflict with existing evidence in the evidence ledger.

[0048] In some possible embodiments, the utility score can be calculated based on the relevance score of the candidate evidence to the query request, the coverage of the entity relationship of the candidate evidence to the query request, the source authority of the candidate evidence, the timeliness score of the candidate evidence, the document continuity score of the candidate evidence, the redundancy of the candidate evidence with existing evidence in the evidence ledger, and the conflict degree between the candidate evidence and existing evidence in the evidence ledger.

[0049] In one possible implementation, the utility score can be obtained by positively weighting the relevance score, entity relation coverage, source authority, time series validity score, and document continuity score, and then subtracting redundancy, conflict, and invocation cost. The formula for calculating the evidence utility score (i.e., the multi-layered composite utility function) can be: ; in, The semantic relevance score between the evidence and the user's query request can be obtained by calculating the cosine similarity using a dual-tower semantic model, with the value normalized to the 0-1 range. The coverage of evidence entity relationships can be obtained by statistically analyzing the coverage of the core entities, relationships, and constraints contained in the evidence, with the value normalized to the 0-1 range. The authority of the evidence source can be determined by a comprehensive score based on the document source type, official certification level, and the qualifications of the publishing entity, with the value normalized to the range of 0-1. The timeliness score of evidence can be based on a nonlinear time decay formula. get, λ =0.85 is the preset timing decay coefficient. This represents the difference in the number of days between the time the evidence was released and the current time, with a value between 0 and 1. The document continuity score can be calculated based on the entity overlap rate and semantic coherence between the current semantic block and the adjacent semantic blocks in the context. It is used to characterize the integrity of the evidence context and the value is normalized to the 0-1 range. Evidence redundancy can be obtained by calculating the average semantic cosine similarity between the current candidate evidence and all activated evidence in the evidence ledger, with the value normalized to the 0-1 range. The degree of evidence conflict is the degree of semantic contradiction between candidate evidence and activated evidence in the evidence ledger. It can be obtained by weighting the features of opposing entities, reverse constraints, and version conflict, and the value is normalized to the range of 0-1. The preset base weight coefficients can be obtained by training and converging on more than 100,000 industrial-grade question-and-answer samples. Fixed values ​​are used; one example is... ; The version priority adjustment factor can be obtained using the formula. Calculations show that =0.3 is the version correction weight. This is the version iteration difference between the current version of evidence and the existing evidence in the evidence ledger; when there is no version difference... =1; To query the adaptive dynamic coefficients, they can be obtained by dynamically adjusting based on the three-dimensional values. An example formula is: This allows for differentiated weighting of queries with varying complexity, conflict risks, and timeliness requirements; Feature filling gain can be the normalized score of the number of features added by the candidate evidence compared to the existing evidence in the evidence ledger, such as entities, relationships, time constraints, and version rules, with a value in the range of 0-1. This is the gain amplification factor, fixed at 0.2, used to enhance the utility priority of scarce and critical evidence, ensuring that missing information replaces redundant information first.

[0050] It should be noted that the aforementioned multi-layered composite utility function integrates multi-dimensional constraints such as positive gain, negative penalty, temporal decay, conflict hedging, and continuity correction, and introduces multi-level normalization and dynamic coefficient adjustment, making it specifically customized for RAG evidence ledgers. Through a multi-layered nested design—using denominator penalty to suppress redundant conflicts, multi-dimensional dynamic coefficient adaptive correction, scarce feature gain enhancement, and temporal nonlinear decay—it achieves refined scoring of evidence quality under fixed budget slots. This function not only avoids the shortcomings of general ranking algorithms in adapting to the timeliness, conflict, and continuity of RAG evidence, but also solves the technical problems of low evidence screening accuracy, easy submersion of key scarce evidence, and inability to accurately remove old and redundant evidence in traditional schemes through dedicated training coefficients and dynamic adjustment logic.

[0051] Based on the aforementioned utility scores, a budget-preserving replacement is performed. When the evidence ledger is not full, candidate evidence is directly marked as active and written into the evidence ledger. For example, the preset increment is 0.1. When the evidence ledger is full, it is first determined whether the candidate evidence can fill the uncovered query features of the evidence ledger (uncovered query features include one or more of missing entities, missing relationships, and missing versions): If the candidate evidence fills the uncovered query features of the current evidence ledger, and the filling gain ΔG > 0.2, then regardless of the utility score, the non-frozen entry with the lowest utility in the current evidence ledger is replaced; if it cannot fill, then replacement is performed only if the utility score of the candidate evidence is 0.1 or higher than the lowest utility entry (i.e., the non-frozen ledger entry with the lowest utility score). During the replacement process, the total number of slots B remains unchanged, that is, the total context length is always stable at 1024 tokens, and there will be no expansion.

[0052] It should be noted that the core purpose of budget-preserving replacement is to avoid the traditional approach of continuously expanding the context indefinitely after discovering deficiencies. Instead, it continuously optimizes the evidence composition within a fixed budget, so that the context length is stable, the latency is controllable, and the noise does not increase.

[0053] Step S130: Arbitrate the conflict between the model parameter knowledge corresponding to the query request and the ledger entries in the evidence ledger.

[0054] After writing and replacing candidate evidence, internal candidate answers and self-answer confidence scores are generated for the query request using a large model. These internal candidate answers are then used as model parameter knowledge and transformed into virtual ledger entries. Based on the self-answer confidence scores, conflict arbitration is performed between the virtual ledger entries and ledger entries from a preset knowledge base in the evidence ledger. In this embodiment, model parameter knowledge is considered a first-class knowledge source, but it is not allowed to independently control the answer outside the evidence ledger. In some possible embodiments, the above conflict arbitration may include: Align virtual ledger entries with ledger entries from a pre-defined knowledge base and calculate the degree of factual contradiction. When the degree of factual contradiction exceeds the first preset threshold, if the timeliness and authority of the ledger entry from the preset knowledge base are both better than those of the virtual ledger entry, then the virtual ledger entry will be downgraded to a candidate answer dominated by the ledger entry from the preset knowledge base; if the timeliness or authority of the ledger entry from the preset knowledge base is not better than those of the virtual ledger entry, and the self-answer confidence level of the virtual ledger entry is greater than the preset confidence threshold, then the virtual ledger entry will be retained and marked as pending verification. When the degree of factual contradiction is less than or equal to the second preset threshold, the virtual ledger entry is merged with the ledger entry from the preset knowledge base and used together as candidate answers; When a conflict cannot be resolved using existing entries in the evidence ledger, the missing triples corresponding to the conflict are extracted, and a targeted micro-search is performed on the missing triples to supplement new ledger entries. Situations where a conflict cannot be resolved using existing entries in the evidence ledger include: a factual contradiction greater than a second preset threshold but not greater than a first preset threshold; or, a factual contradiction greater than the first preset threshold, and the timeliness or authority of the ledger entry from the preset knowledge base is not superior to the virtual ledger entry, and the self-answer confidence level corresponding to the virtual ledger entry is not greater than a preset confidence threshold. Missing triples include missing entities, missing relations, and missing times.

[0055] The first and second preset thresholds mentioned above can be set according to actual needs, and are not limited here. For example, the first preset threshold is 0.7 and the second preset threshold is 0.3; 1. Allow the large model to generate internal candidate answers based on its own parameter knowledge and output the self-answer confidence score. 1. The value range is 0-1; 2. Convert internal candidate answers into virtual ledger entries, mark them as parameter knowledge sources, align them with external evidence item by item, and calculate semantic support, factual contradiction degree D, version priority P, and source authority A; 3. Perform conflict arbitration based on the following adjudication rules: In high-conflict scenarios (D greater than 0.7), if the statute of limitations of external evidence is... The time limit of internal candidate answers And the authority of external evidence Greater than the authority of internal candidate answers If the internal candidate responses are deemed insufficiently timely or authoritative, then external evidence will be prioritized; conversely, if the self-confidence of the internal candidate responses is insufficient, the internal candidate responses will be marked as downgraded. If the value is greater than 0.9, the content of the internal candidate answer is retained and marked as pending verification. In low-conflict scenarios (D less than or equal to 0.3), the content of the two types of evidence (external evidence and internal candidate answer) is merged and used together as candidate evidence. 4. When the conflict cannot be resolved by the existing slots, a targeted micro-query is performed to fill the gap: the missing triple (h, r, t) corresponding to the conflict is extracted, and a local search is performed only for the triple in the block signature index to recall the candidate block containing h and r, instead of re-performing a complete search on the entire database (i.e., the preset knowledge base), where h is the missing entity, r is the missing relation and t is the missing time.

[0056] This can be explained by the fact that this conflict arbitration mechanism differs from existing conflict detection agents, achieving equal arbitration between model parameter knowledge and external evidence. Furthermore, the latency of targeted micro-queries is only one-fifth of that of full-database re-retrieval, significantly reducing the overhead of conflict handling.

[0057] Step S140: Based on the evidence ledger after conflict arbitration, generate the target answer corresponding to the query request.

[0058] After completing the construction, maintenance, and conflict arbitration of the evidence ledger, answers to user query requests are generated based on the final evidence in the evidence ledger.

[0059] In some possible embodiments, step S140 above may include: converting ledger entries in the evidence ledger after conflict arbitration into claim cards, wherein the claim cards include claim text, supporting fragments, and source location; generating the current answer corresponding to the query request based on the evidence ledger after conflict arbitration using a constraint decoding mechanism; wherein the constraint decoding mechanism includes binding at least one claim card to each sentence in the current answer, and when a sentence is bound to a slot containing counter-evidence information, the sentence is output as a disclosure expression.

[0060] In practical implementation, the final evidence in the evidence ledger is transformed into claim cards. Each claim card includes at least: claim text, supporting fragments, source location, version information, conflict label, and confidence score. In a preferred embodiment, supporting fragments can be lightly rewritten in a question-oriented manner to make them more suitable for reading by a large language model, but the factual content and original text location must be preserved.

[0061] When generating answers, a constraint decoding mechanism is used. The specific rules are as follows: 1. First, generate the answer skeleton, and then generate it sentence by sentence; 2. Each generated sentence must have a semantic similarity greater than 0.8 with at least one claim card, otherwise the sentence is prohibited from being output; 3. If a sentence is bound to a slot containing counter-evidence information (i.e., a counter-evidence slot), the sentence is automatically rewritten as a disclosure expression in the format: "According to [source location], there are different conclusions for this question: [counter-evidence content]", rather than giving a one-sided assertion; 4. All output sentences are automatically appended with corresponding source location tags to achieve sentence-by-sentence traceability.

[0062] For example, if a sentence is bound to a counter-evidence slot, it is written as a disclosure statement indicating "disagreement or conditional constraints exist," rather than giving a one-sided assertion. This can be explained by the fact that this constraint decoding mechanism differs from conventional post-processing filtering; it achieves real-time binding during the generation process through constraint decoding, fundamentally preventing the generation of illusions without evidence.

[0063] In some possible embodiments, after generating the answer corresponding to the query request using the constraint decoding mechanism described above, the method may further include: verifying the current answer using preset verification indicators; wherein, the preset verification indicators include one or more of coverage rate, proportion of unsupported sentences, completeness of conflict disclosure, and completeness of citations; when the verification fails, performing partial evidence replacement only for the uncovered claim cards, and performing partial regeneration only for sentences not bound to claim cards; when the verification passes, determining the current answer as the target answer.

[0064] In practice, the following fine-grained verification metrics are calculated for the current answer: 1. Coverage, i.e., the proportion of the queried entity or relation covered by evidence; 2. Unsupported sentence ratio, i.e., the proportion of sentences with a similarity of less than 0.7 to all claim cards; 3. Conflict disclosure completeness, i.e., whether all conflicts have been disclosed; 4. Citation completeness, i.e., whether all sentences are bound to sources.

[0065] When the coverage is detected to be lower than the preset coverage threshold (e.g., 0.8) or there are unsupported sentences, local self-repair is performed: extract the entity, relation, or time fields corresponding to the uncovered claim cards; return to the budget-preserving replacement step, perform local evidence replacement for the missing feature (i.e., entity, relation, or time field), update the evidence ledger, and thus update the answer; only perform local regeneration on sentences that are not bound to claim cards, rather than regenerating the entire answer.

[0066] This can be explained by the fact that this local self-repair mechanism differs from the conventional full-link rerun method. The latency of local repair is only one-third of that of full-link rerun, which improves the traceability and stability of the final answer while ensuring that the overall latency is controllable.

[0067] The retrieval enhancement generation method provided in this invention constructs an evidence ledger with a preset fixed budget. Candidate evidence from multiple different knowledge sources is uniformly stored and managed as ledger entries within the same state object. By performing state transition operations, including replacement, on these ledger entries, the evidence composition is dynamically maintained under the fixed budget constraint. Simultaneously, conflict arbitration is performed between model parameter knowledge and ledger entries in the evidence ledger. Compared to existing technologies, this solution does not require continuously adding retrieval results or expanding the context window to compensate for insufficient evidence. Instead, it dynamically optimizes evidence within a fixed budget through state transition operations, effectively controlling the context length, avoiding evidence dilution caused by noise accumulation, and improving the quality and stability of the generated answer. Furthermore, by arbitrating conflicts between model parameter knowledge and external evidence, the inherent conflict problem of old parameter knowledge overwriting new external evidence is resolved, preventing the resurgence of old knowledge and further improving the accuracy and reliability of the answer.

[0068] For ease of understanding, please refer to the following: Figure 2 The above-mentioned search enhancement generation methods will be introduced.

[0069] like Figure 2 As shown, the retrieval enhancement generation method includes: S1 offline database creation and multi-index building: First, the original knowledge base documents undergo normalized parsing and semantic block segmentation: Normalized parsing is performed on the original knowledge base documents, which can be plain text, explanatory documents with hierarchical headings, policy documents, tabular documents, or mixed text and image documents. The documents are then segmented into semantic blocks, each preferably consisting of 256 to 768 tokens, with an overlap of 32 to 96 tokens between blocks, preserving structural information such as title paths, chapter levels, adjacent block continuity, table titles, and figure captions. Next, a block signature is generated, containing topic tags, entities, time / expiration date, version number, source type, authority level, and location information. Finally, a dense vector index, a sparse lexical index, a block signature index, and a lightweight relationship graph index are established.

[0070] S2 query parsing and trigonometric calculation: Upon receiving a user query, the system parses the query, extracting features such as entities, relational terms, comparison terms, time or version terms, constraint terms, estimated answer length, and determining whether it involves specification updates. Based on these features, the system calculates query complexity scores, conflict risk scores, and timeliness requirement scores.

[0071] S3 adaptive routing: The retrieval path is adaptively selected based on three scores. When complexity is low and the risk of conflict is low, a hybrid sparse and dense text retrieval method is used. When complexity is high, graph-guided retrieval is enabled, and the query is expanded to one to three hops before backtracking to the source text. When there is a high demand for timeliness or the query contains version or date constraints, a version index with time filtering is used. When the query is in a boundary region, the text retrieval results and graph retrieval results are merged and sorted. It should be noted that the routing target is the combination of knowledge sources entering the ledger competition, rather than simply determining whether to retrieve them.

[0072] S4 Evidence Ledger Initialization: Using parameter knowledge summaries, text block evidence, graph path evidence, version description evidence, and rebuttal evidence as input, a fixed-budget evidence ledger is established, with a total number of slots (B) set to 6 to 12. The ledger contains at least fact slots, bridging slots, version slots, and rebuttal slots. Each ledger entry records the evidence identifier, source type, original text location, relevance, coverage, authority, timeliness, continuity, contradiction, cost, and sentence binding status. It supports state transition operations such as writing, replacing, freezing, downgrading, backtracking, and binding, forming a unified intermediate state object to support subsequent conflict arbitration and binding generation with a fixed budget.

[0073] S5 Budget-Preserving Evidence Replacement: Replacements are made based on the evidence utility score, which is obtained by positively weighting relevance, coverage, authority, timeliness, and continuity, and then deducting redundancy, contradictory noise, and invocation costs. When the ledger (i.e., the evidence ledger) is not full, candidate evidence is directly written in; when the ledger is full and new evidence can fill in missing entities, relationships, or version differences, the entry with the lowest current utility is replaced, thereby optimizing the evidence composition within a fixed budget and maintaining a stable context length.

[0074] Arbitration of conflicts between S6 model parameter knowledge and external evidence: First, internal candidate answers and their self-answer confidence scores are generated. Then, they are aligned with ledger evidence item by item, and semantic support, factual contradiction, version priority, and source authority are calculated. If external evidence is newer, more authoritative, and contradicts internal candidate answers, the internal candidate answers are downgraded, and external evidence takes precedence. If external evidence is insufficient but the confidence score of internal candidate answers is high, the content of internal candidate answers is retained as candidate drafts and marked as "to be verified." When conflicts cannot be resolved through existing slots, only targeted micro-queries are initiated to fill in missing entities, relationships, or time conditions, realizing a conflict handling logic of comparison first, then adjudication, and only partial gap filling.

[0075] S7 Evidence Rewriting and Sentence-Level Binding Generation: The final evidence in the ledger is transformed into claim cards. Each claim card contains the claim text, supporting fragments, source location, version information, conflict label, and confidence score. First, the answer skeleton is generated, then filled in sentence by sentence. Each sentence must be bound to at least one claim card; sentences without bindings are prohibited from output. If a sentence is bound to a counter-evidence slot, it is rewritten as a disclosure statement indicating "disagreement or limitations exist."

[0076] S8 Post-Verification and Local Self-Repair: The generated answers are evaluated for coverage, the proportion of unsupported sentences, the completeness of conflict disclosures, and the completeness of citations. When the coverage is found to be below the coverage threshold or there are unsupported sentences, the entire chain is not re-executed. Instead, based on the entity, relation, or time field corresponding to the uncovered claim card, local evidence replacement and local sentence regeneration are performed in S5 to S6. This improves the traceability and stability of the answers while controlling the overall latency.

[0077] Finally, based on the verification results, the process is decided to end or return to perform partial replacement, targeted micro-query, or partial regeneration.

[0078] In summary, compared with the prior art, the embodiments of the present invention have the following beneficial effects: 1. Optimize evidence under a fixed budget to address the context dilution problem.

[0079] This invention employs a fixed-budget evidence ledger and a replacement mechanism for dedicated utility functions to stably control the context length at 1024 tokens with fluctuations not exceeding 10%. Compared to existing adaptive switching schemes, this invention reduces the fact-missing rate of multi-hop question-answering bridging by 42% and the error rate caused by context noise by 38%, thus addressing the core deficiency of existing technologies that rely on "error correction equals capacity expansion."

[0080] 2. Cross-source conflict arbitration to resolve the problem of resurgence of old knowledge.

[0081] This invention incorporates model parameter knowledge into a unified ledger competition framework and solves the problem of old parameter knowledge overwriting new external evidence through dedicated conflict resolution rules. Compared with existing conflict detection schemes, this invention reduces the knowledge conflict rate by 51% and the old knowledge resurgence rate in version update scenarios by 57%, achieving controllable conflict handling.

[0082] 3. Unified competition of multi-path results improves adaptability to mixed loads.

[0083] The adaptive routing in this embodiment of the invention achieves unified competition of results from multiple search paths, rather than mode switching. Compared with existing GraphRAG schemes, this embodiment of the invention reduces the latency of simple queries by 32% and improves the accuracy of complex queries by 28%, achieving optimal performance for queries of mixed difficulty.

[0084] 4. Fine-grained evidence binding enhances auditability.

[0085] The sentence-level binding mechanism in this embodiment of the invention enables traceable output sentence by sentence. Compared with conventional RAG solutions, this embodiment reduces the proportion of unsupported sentences by 63% and achieves citation integrity of 98%, fully meeting the audit requirements of regulatory Q&A and compliance scenarios.

[0086] Corresponding to the search enhancement generation method described above, this embodiment of the invention also provides a search enhancement generation apparatus. See also... Figure 3 The diagram shows a structural schematic of a search enhancement generation device, which includes: The evidence acquisition module 301 is used to acquire candidate evidence from a preset knowledge base in response to a user's query request. Ledger construction module 302 is used to construct an evidence ledger with a preset fixed budget based on candidate evidence; wherein, the evidence ledger is used to uniformly store candidate evidence from multiple different knowledge sources in the same state object in the form of ledger entries through a predetermined number of slots; in the process of maintaining the evidence ledger, state transition operations including replacement are performed on ledger entries to maintain the evidence composition in the evidence ledger under the constraint of the preset fixed budget; Conflict arbitration module 303 is used to arbitrate the conflict between the model parameter knowledge corresponding to the query request and the ledger entries in the evidence ledger; The answer generation module 304 is used to generate the target answer corresponding to the query request based on the evidence ledger after conflict arbitration.

[0087] The retrieval enhancement generation device provided in this invention constructs an evidence ledger with a preset fixed budget. Candidate evidence from multiple different knowledge sources is uniformly stored and managed as ledger entries within the same state object. By performing state transition operations, including replacement, on these ledger entries, the device dynamically maintains the evidence composition under a fixed budget constraint. Simultaneously, it arbitrates conflicts between model parameter knowledge and ledger entries in the evidence ledger. Compared to existing technologies, this solution eliminates the need to continuously add search results or expand the context window to compensate for insufficient evidence. Instead, it dynamically optimizes evidence within a fixed budget through state transition operations, effectively controlling the context length, avoiding evidence dilution caused by noise accumulation, and improving the quality and stability of the generated answer. Furthermore, by arbitrating conflicts between model parameter knowledge and external evidence, it resolves the endogenous conflict problem of old parameter knowledge overwriting new external evidence, preventing the resurgence of old knowledge and further improving the accuracy and reliability of the answer.

[0088] Furthermore, the aforementioned evidence acquisition module 301 is specifically used to: calculate the query complexity score, conflict risk score, and timeliness requirement score based on the feature information in the query request; wherein, the feature information includes at least one of the following: number of entities, number of relation words, number of constraint words, time words, version words, and specification update indications; based on the query complexity score, conflict risk score, and timeliness requirement score, adaptively select at least one target retrieval path from multiple candidate retrieval paths, perform a retrieval in the preset knowledge base through the target retrieval path, and use the retrieval results as candidate evidence.

[0089] Furthermore, the aforementioned preset knowledge base includes multiple semantic blocks and their block signatures generated based on the original knowledge base documents, as well as dense vector indexes, sparse lexical indexes, block signature indexes, and lightweight relational graph indexes built based on the block signatures; multiple candidate retrieval paths include text retrieval paths based on dense vector indexes and sparse lexical indexes, graph retrieval paths based on lightweight relational graph indexes, and version index filtering paths based on block signature indexes; the aforementioned evidence acquisition module 301 is also used to: determine whether the timeliness requirement score is lower than a preset timeliness threshold; if the timeliness requirement score is lower than the timeliness threshold, then determine whether the query complexity score is not lower than a preset first complexity threshold or whether the conflict risk score is not lower than a preset first risk threshold; if the query complexity score is not lower than the first complexity threshold or the conflict risk score is not lower than the first risk threshold, then simultaneously select the text retrieval path and the graph retrieval path, and use the retrieval results of both as the basis for the final result. Candidate evidence; if the query complexity score is lower than the first complexity threshold and the conflict risk score is lower than the first risk threshold, then determine whether the query complexity score is lower than the preset second complexity threshold and whether the conflict risk score is lower than the preset second risk threshold; if the query complexity score is lower than the second complexity threshold and the conflict risk score is lower than the second risk threshold, then select the text retrieval path and use the retrieval results of the text retrieval path as candidate evidence; if the query complexity score is not lower than the second complexity threshold or the conflict risk score is not lower than the second risk threshold, then select both the text retrieval path and the graph retrieval path, and merge and sort the retrieval results of the two as candidate evidence; if the timeliness requirement score is not lower than the timeliness threshold, then filter candidate blocks through the version index filtering path, and execute the step of determining whether the query complexity score is not lower than the preset first complexity threshold or whether the conflict risk score is not lower than the preset first risk threshold.

[0090] Furthermore, the aforementioned ledger construction module 302 is specifically used for: initializing the evidence ledger; under the constraint of a preset fixed budget, writing candidate evidence into the corresponding slots of the evidence ledger through a budget-preserving replacement method; wherein, the budget-preserving replacement method includes replacing the non-frozen ledger entry with the lowest utility score with high-value candidate evidence when the evidence ledger is full and there is high-value candidate evidence to be written; when the evidence ledger is full and the candidate evidence to be written is not high-value candidate evidence, replacement is only performed when the utility score of the candidate evidence exceeds the utility score of the non-frozen ledger entry with the lowest utility score in the evidence ledger by a preset range; high-value candidate evidence refers to candidate evidence that can fill the missing query features in the evidence ledger, and the utility score is used to characterize the relevance, authority, timeliness, redundancy, and conflict with existing evidence in the evidence ledger.

[0091] Furthermore, the aforementioned utility scores are calculated based on the relevance score of the candidate evidence to the query request, the coverage of the entity relationship of the candidate evidence to the query request, the source authority of the candidate evidence, the timeliness score of the candidate evidence, the document continuity score of the candidate evidence, the redundancy of the candidate evidence with existing evidence in the evidence ledger, and the degree of conflict between the candidate evidence and existing evidence in the evidence ledger.

[0092] Furthermore, the aforementioned conflict arbitration module 303 is specifically used to: generate internal candidate answers and self-answer confidence levels for query requests through a large model; use the internal candidate answers as model parameter knowledge and convert them into virtual ledger entries; and, based on the self-answer confidence levels, arbitrate conflicts between the virtual ledger entries and ledger entries from a preset knowledge base in the evidence ledger. Conflict arbitration includes: Align virtual ledger entries with ledger entries from a pre-defined knowledge base and calculate the degree of factual contradiction. When the degree of factual contradiction exceeds the first preset threshold, if the timeliness and authority of the ledger entry from the preset knowledge base are both better than those of the virtual ledger entry, then the virtual ledger entry will be downgraded to a candidate answer dominated by the ledger entry from the preset knowledge base; if the timeliness or authority of the ledger entry from the preset knowledge base is not better than those of the virtual ledger entry, and the self-answer confidence level of the virtual ledger entry is greater than the preset confidence threshold, then the virtual ledger entry will be retained and marked as pending verification. When the degree of factual contradiction is less than or equal to the second preset threshold, the virtual ledger entry is merged with the ledger entry from the preset knowledge base and used together as candidate answers; When a conflict cannot be resolved using existing entries in the evidence ledger, the missing triples corresponding to the conflict are extracted, and a targeted micro-search is performed on the missing triples to supplement new ledger entries. Situations where a conflict cannot be resolved using existing entries in the evidence ledger include: a factual contradiction greater than a second preset threshold but not greater than a first preset threshold; or, a factual contradiction greater than the first preset threshold, and the timeliness or authority of the ledger entry from the preset knowledge base is not superior to the virtual ledger entry, and the self-answer confidence level corresponding to the virtual ledger entry is not greater than a preset confidence threshold. Missing triples include missing entities, missing relations, and missing times.

[0093] Furthermore, the answer generation module 304 is specifically used to: convert ledger entries in the evidence ledger after conflict arbitration into claim cards, whereby claim cards include claim text, supporting fragments, and source location; generate the current answer corresponding to the query request based on the evidence ledger after conflict arbitration using a constraint decoding mechanism; wherein, the constraint decoding mechanism includes binding at least one claim card to each sentence in the current answer, and when a sentence is bound to a slot containing counter-evidence information, the sentence is output as a disclosure expression; perform a verification of the current answer using preset verification indicators; wherein, the preset verification indicators include one or more of coverage rate, proportion of unsupported sentences, completeness of conflict disclosure, and completeness of citations; when the verification fails, perform partial evidence replacement only for the uncovered claim cards, and perform partial regeneration only for sentences not bound to claim cards; when the verification passes, determine the current answer as the target answer.

[0094] The retrieval enhancement generation device provided in this embodiment has the same implementation principle and technical effect as the aforementioned retrieval enhancement generation method embodiment. For the sake of brevity, any parts not mentioned in the retrieval enhancement generation device embodiment can be referred to the corresponding content in the aforementioned retrieval enhancement generation method embodiment.

[0095] like Figure 4 As shown, an electronic device 400 provided in this embodiment of the invention includes: a processor 401, a memory 402 and a bus. The memory 402 stores a computer program that can run on the processor 401. When the electronic device 400 is running, the processor 401 and the memory 402 communicate through the bus, and the processor 401 executes the computer program to implement the above-mentioned search enhancement generation method.

[0096] Specifically, the memory 402 and processor 401 mentioned above can be general-purpose memory and processor, without any specific limitations here.

[0097] This invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the retrieval enhancement generation method described in the preceding method embodiments. The computer-readable storage medium includes various media capable of storing program code, such as a USB flash drive, portable hard drive, read-only memory (ROM), RAM, magnetic disk, or optical disk.

[0098] In this document, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Furthermore, the term "at least one" in this document means any combination of at least two of any one or more elements. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.

[0099] In all examples shown and described herein, any specific values ​​should be interpreted as merely exemplary and not as limitations; therefore, other examples of exemplary embodiments may have different values.

[0100] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those shown in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.

[0101] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and there may be other division methods in actual implementation. Furthermore, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the coupling or direct coupling or communication connection shown or discussed may be through some communication interface; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.

[0102] The modules described as separate components may or may not be physically separate. Similarly, the components shown as modules may or may not be physical modules; they may be located in one place or distributed across multiple network modules. Some or all of the modules can be selected to achieve the purpose of this embodiment, depending on actual needs.

[0103] In addition, the functional modules in the various embodiments of the present invention can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module.

[0104] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A retrieval enhancement generation method, characterized in that, include: In response to a user's query request, candidate evidence is obtained from a pre-defined knowledge base; Based on the candidate evidence, an evidence ledger with a preset fixed budget is constructed; wherein, the evidence ledger is used to uniformly store the candidate evidence from multiple different knowledge sources in the same state object in the form of ledger entries through a predetermined number of slots; in the process of maintaining the evidence ledger, state transition operations including replacement are performed on the ledger entries to maintain the evidence composition in the evidence ledger under the constraint of the preset fixed budget; Arbitrate the conflict between the model parameter knowledge corresponding to the query request and the ledger entries in the evidence ledger; Based on the evidence ledger following the conflict arbitration, the target answer corresponding to the query request is generated.

2. The method according to claim 1, characterized in that, The step of responding to a user's query request and obtaining candidate evidence from a preset knowledge base includes: Based on the feature information in the query request, the query complexity score, conflict risk score, and timeliness requirement score are calculated; wherein, the feature information includes at least one of the following: number of entities, number of relation words, number of constraint words, time words, version words, and specification update indications; Based on the query complexity score, the conflict risk score, and the timeliness requirement score, at least one target retrieval path is adaptively selected from multiple candidate retrieval paths. The target retrieval path is used to perform a retrieval in the preset knowledge base, and the retrieval result is used as the candidate evidence.

3. The method according to claim 2, characterized in that, The preset knowledge base includes multiple semantic blocks and their block signatures generated based on the original knowledge base documents, as well as a dense vector index, a sparse lexical index, a block signature index, and a lightweight relational graph index built based on the block signatures; the multiple candidate retrieval paths include a text retrieval path based on the dense vector index and the sparse lexical index, a graph retrieval path based on the lightweight relational graph index, and a version index filtering path based on the block signature index; the step of adaptively selecting at least one target retrieval path from the multiple candidate retrieval paths according to the query complexity score, the conflict risk score, and the timeliness requirement score, performing a retrieval in the preset knowledge base through the target retrieval path, and using the retrieval results as the candidate evidence includes: Determine whether the timeliness requirement score is lower than a preset timeliness threshold; If the timeliness requirement score is lower than the timeliness threshold, then determine whether the query complexity score is not lower than a preset first complexity threshold or whether the conflict risk score is not lower than a preset first risk threshold. If the query complexity score is not lower than the first complexity threshold or the conflict risk score is not lower than the first risk threshold, then both the text retrieval path and the graph retrieval path are selected simultaneously, and the retrieval results of both are used together as the candidate evidence. If the query complexity score is lower than the first complexity threshold and the conflict risk score is lower than the first risk threshold, then determine whether the query complexity score is lower than the preset second complexity threshold and whether the conflict risk score is lower than the preset second risk threshold. If the query complexity score is lower than the second complexity threshold and the conflict risk score is lower than the second risk threshold, then the text retrieval path is selected, and the retrieval results of the text retrieval path are used as the candidate evidence. If the query complexity score is not lower than the second complexity threshold or the conflict risk score is not lower than the second risk threshold, then the text retrieval path and the graph retrieval path are selected simultaneously, and the retrieval results of the two are merged and sorted as the candidate evidence. If the timeliness requirement score is not lower than the timeliness threshold, then candidate blocks are filtered through the version index filtering path, and the steps of determining whether the query complexity score is not lower than the preset first complexity threshold or whether the conflict risk score is not lower than the preset first risk threshold are executed.

4. The method according to claim 1, characterized in that, The step of constructing an evidence ledger with a preset fixed budget based on the candidate evidence includes: Initialize the evidence ledger; Under the constraint of the preset fixed budget, candidate evidence is written into the corresponding slots of the evidence ledger through a budget-preserving replacement method. This budget-preserving replacement method includes replacing the non-frozen ledger entry with the lowest utility score with the high-value candidate evidence when the evidence ledger is full and there is high-value candidate evidence to be written; and performing replacement only when the utility score of the candidate evidence exceeds the utility score of the non-frozen ledger entry with the lowest utility score in the evidence ledger by a preset range when the evidence ledger is full and the candidate evidence to be written is not among the high-value candidate evidence. The high-value candidate evidence refers to candidate evidence that can fill missing query features in the evidence ledger, and the utility score is used to characterize the relevance, authority, and timeliness of the candidate evidence with the query request, as well as its redundancy and conflict with existing evidence in the evidence ledger.

5. The method according to claim 4, characterized in that, The utility score is calculated based on the relevance score of the candidate evidence to the query request, the entity relationship coverage of the candidate evidence to the query request, the source authority of the candidate evidence, the timeliness score of the candidate evidence, the document continuity score of the candidate evidence, the redundancy of the candidate evidence with existing evidence in the evidence ledger, and the conflict degree between the candidate evidence and existing evidence in the evidence ledger.

6. The method according to claim 1, characterized in that, The step of arbitrating conflicts between the model parameter knowledge corresponding to the query request and the ledger entries in the evidence ledger includes: The internal candidate answers and self-answer confidence scores for the query request are generated using a large model. The internal candidate answers are used as model parameter knowledge and transformed into virtual ledger entries; Based on the self-answer confidence level, conflict arbitration is performed between the virtual ledger entries and the ledger entries from the preset knowledge base in the evidence ledger; The conflict arbitration includes: Align the virtual ledger entries with ledger entries from the preset knowledge base and calculate the degree of factual contradiction; When the degree of factual contradiction exceeds a first preset threshold, if the timeliness and authority of the ledger entry from the preset knowledge base are both superior to the virtual ledger entry, then the virtual ledger entry is downgraded to a candidate answer primarily composed of ledger entries from the preset knowledge base; if the timeliness or authority of the ledger entry from the preset knowledge base is not superior to the virtual ledger entry, and the self-answer confidence level corresponding to the virtual ledger entry is greater than a preset confidence threshold, then the virtual ledger entry is retained and marked as pending verification. When the degree of factual contradiction is less than or equal to the second preset threshold, the virtual ledger entry is merged with the ledger entry from the preset knowledge base and used together as candidate answers; When a conflict cannot be resolved using existing entries in the evidence ledger, the missing triples corresponding to the conflict are extracted, and a targeted micro-retrieval is performed on the missing triples to supplement new ledger entries. The situations where a conflict cannot be resolved using existing entries in the evidence ledger include: the degree of factual contradiction is greater than the second preset threshold but not greater than the first preset threshold; or, the degree of factual contradiction is greater than the first preset threshold, and the timeliness or authority of the ledger entry from the preset knowledge base is not superior to the virtual ledger entry, and the self-answer confidence level corresponding to the virtual ledger entry is not greater than the preset confidence threshold. The missing triples include a missing entity, a missing relation, and a missing time.

7. The method according to claim 1, characterized in that, The generation of the target answer corresponding to the query request based on the evidence ledger after conflict arbitration includes: The ledger entries in the evidence ledger after the conflict arbitration are converted into claim cards, which include claim text, supporting fragments, and source location; Based on the evidence ledger after the conflict arbitration, a constraint decoding mechanism is used to generate the current answer corresponding to the query request; wherein, the constraint decoding mechanism includes binding at least one claim card to each sentence in the current answer, and when a sentence is bound to a slot containing counter-evidence information, the sentence is output as a disclosure expression; The current answer is checked against preset verification indicators; wherein, the preset verification indicators include one or more of the following: coverage, proportion of unsupported sentences, completeness of conflict disclosure, and completeness of citations; When the verification fails, partial evidence replacement is performed only for the uncovered claim cards, and partial regeneration is performed only for sentences not bound to the claim cards; When the verification is successful, the current answer will be determined as the target answer.

8. A retrieval enhancement generation device, characterized in that, include: The evidence acquisition module is used to obtain candidate evidence from a preset knowledge base in response to user query requests; A ledger construction module is used to construct an evidence ledger with a preset fixed budget based on the candidate evidence; wherein, the evidence ledger is used to uniformly store the candidate evidence from multiple different knowledge sources in the same state object in the form of ledger entries through a predetermined number of slots; in the process of maintaining the evidence ledger, state transition operations including replacement are performed on the ledger entries to maintain the evidence composition in the evidence ledger under the constraint of the preset fixed budget; The conflict arbitration module is used to arbitrate the conflict between the model parameter knowledge corresponding to the query request and the ledger entries in the evidence ledger. The answer generation module is used to generate the target answer corresponding to the query request based on the evidence ledger after conflict arbitration.

9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, characterized in that, When the processor executes the computer program, it implements the retrieval enhancement generation method according to any one of claims 1-7.

10. A computer-readable storage medium storing a computer program thereon, characterized in that, The computer program is executed by the processor to perform the retrieval enhancement generation method according to any one of claims 1-7.