A financial RAG defense method and system based on trusted anchor point conflict detection and continuous query
By introducing trusted anchor conflict detection and continuous querying into the financial RAG system, full-dimensional verification and hierarchical processing of new data are achieved, solving the problems of knowledge base pollution and retrieval tampering, improving the system's stability and question-answering accuracy, and meeting financial compliance requirements.
Patent Information
- Application Number
- CN202611303018.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-26
- Publication Date
- 2026-11-27
AI Technical Summary
Existing financial RAG systems lack effective end-to-end defense mechanisms, are unable to identify and defend against knowledge base contamination and retrieval parameter tampering, leading to investment misrepresentation and system instability, and lack end-to-end version management and automated rollback mechanisms.
The method of trusted anchor conflict detection and continuous query is adopted. By isolating candidate knowledge areas from formal knowledge areas, the search results are compared using trusted anchors. Combined with multi-dimensional risk assessment and hierarchical handling, the method achieves full-dimensional verification of new data and performs incremental retrieval and answer generation control when the evidence is insufficient.
Effectively isolate contaminated data, identify search engine anomalies, reduce erroneous output, meet financial compliance requirements, improve system stability and question-and-answer accuracy, and reduce investment misrepresentation.
Smart Images

Figure CN123179408A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of financial information security and retrieval-augmented generation technology, and in particular to a financial RAG (Retrieval-Augmented Generation) defense method and system based on trusted anchor conflict detection and continuous query. Background Technology
[0002] The standard financial RAG (Research and Analysis Group) workflow typically includes data collection, text parsing and segmentation, vectorization encoding, and vector index construction. User questions are encoded, similarity retrieval is performed based on the encoding results, and the retrieval results are reordered. Finally, a large language model generates an answer based on the reordered retrieval results. The industry commonly uses timed or event-triggered incremental data entry, relying solely on vector similarity to return Top-K data, prioritizing timeliness but neglecting to verify data authenticity and the completeness of the retrieval process.
[0003] The existing technical solutions have the following problems: Current systems only verify the source domain and signature format of new data before directly writing it into the online index, without any retrieval behavior access testing. This leads to long-term negative impacts on Q&A after the contaminated data is deployed. Static source whitelists and fixed similarity thresholds cannot identify covert poisoning behaviors such as account theft, batch data rewriting, and single abnormal data covering dozens of business issues. There is no unified way to distinguish between knowledge base text contamination and partial tampering of retrieval parameters, and no unified observation indicators to pinpoint the source of the fault. Knowledge injection attacks are a prominent attack method in financial RAG systems. Attackers inject contaminated data into the knowledge base by forging and tampering with financial reports and research reports, inducing large models to output incorrect investment conclusions, directly causing investment misrepresentation and damage to institutional reputation. Existing defense methods mostly rely solely on source domain and signature format verification, lacking a complete end-to-end defense mechanism against this type of attack. One-time retrieval mechanisms still directly trigger generation when evidence is missing or multiple data sources conflict, outputting incorrect investment judgments. Detection, data demotion, Q&A generation, and abnormal logs are fragmented, lacking a versioned knowledge base and an automatic rollback loop for the retrieval system.
[0004] Existing mature engineering solutions typically involve: verifying the source domain, digital signature, and publication time of data upon entry into the database; setting fixed search scores for authoritative sources; constraining the model to only reference search content using prompt words; and manually sampling the model's answers using a fixed regression question set. The core shortcomings of this solution include: failure to isolate new data to be verified; lack of independent candidate indexes, posing a risk of contaminated data directly entering the online index; failure to comprehensively assess risks related to anchor point search bias, factual conflicts, and cross-question coverage; lack of a tiered handling mechanism; lack of dynamic iterative continuous retrieval; and lack of version control for the knowledge base and search engine, making one-click rollback impossible after an anomaly.
[0005] In related publicly available research, "Conflict-Aware Retriever Editing for KnowledgeInjection Attacks on LLM-Based RAG Systems" (arXiv:2606.18310) is an attack implementation scheme. Its core is manipulating search ranking by editing searcher parameters; it only provides the attack method and lacks defensive logic. "Co-LMLM: Continuous-Query Limited Memory Language Models" (arXiv:2607.07707) requires a pre-trained language model to generate continuous query vectors and relies on the model's hidden state reconstruction. The technical objectives and methods of this invention are fundamentally different from the above-mentioned schemes. Summary of the Invention
[0006] To address the above issues, this invention provides a financial RAG defense method and system based on trusted anchor conflict detection and continuous query.
[0007] In a first aspect, the present invention provides a financial RAG defense method based on trusted anchor conflict detection and continuous query, which adopts the following technical solution: Newly collected financial data is identified as candidate data and stored in a candidate knowledge area, which is isolated from the formal knowledge area used to store risk-verified financial data with trust weights. Based on a preset benchmark test set containing trust anchors, a first search operation is performed to retrieve the formal knowledge area, and a second search operation is performed to retrieve both the formal knowledge area and the candidate knowledge area simultaneously. The search results of the first and second search operations are compared. Based on the difference between the results of the first and second search operations, according to the range of the proportion of trust anchors with decreased rankings to the total number of trust anchors, if trust anchors simultaneously experience a decrease in ranking, it is determined to be an abnormal retrieval parameter tampering; if only some trust anchors show a shift, it is determined to be candidate data contamination. The process involves analyzing the correlation between candidate data and credible anchors to determine the scope of batch contaminated data. A risk assessment model is used to calculate the risk score for each candidate data based on multiple risk characteristic dimensions, and the credibility weight of each candidate data is also calculated. Based on the risk scores, the candidate data is categorized and processed, with low-risk data written into the formal knowledge area. When a user's financial question is received, a hybrid search is performed in conjunction with the formal knowledge area. The evidence status and unmet fact slots are updated based on the search results. The query vector is iteratively updated based on the unmet fact slots, and incremental search is performed to supplement the evidence. The search results obtained from the incremental search are sent to the evidence gating and response generation module, which determines whether the credibility weight, independent information source, and unresolved key factual conflicts of the generated data meet the release conditions.
[0008] Furthermore, the simultaneous ranking decline of trusted anchors means that the number of trusted anchors with a ranking decline accounts for no less than 80% of the total number of trusted anchors in the preset benchmark test set; the offset of only some trusted anchors means that at least one trusted anchor has a ranking decline, and the number of trusted anchors with a ranking decline accounts for less than 80% of the total number of trusted anchors; after determining that the retriever parameter tampering is abnormal, the current retriever is switched to the most recently verified retriever version or the BM25 sparse backup retriever.
[0009] Furthermore, the risk assessment model calculates the risk score based on at least one risk dimension, which includes at least one of the following: financial fact conflict, ranking bias on the benchmark set, cross-issue anomaly coverage, version inconsistency, and source integrity.
[0010] Furthermore, the tiered processing includes: writing low-risk data into the formal knowledge area, setting medium-risk data to a downweighted state, and moving high-risk data into the isolation area.
[0011] Furthermore, generating subsequent queries includes: The user's original question, the retrieved evidence summary, and the text describing the evidence gap are concatenated and then encoded using an embedding model to generate a new query vector.
[0012] Furthermore, the preset evidence quality standards include: The credibility weight of the materials used to generate the answer is higher than a preset threshold; The key facts are supported by at least two independent sources; and there are no unresolved conflicts of key facts in the set of evidence.
[0013] Furthermore, the method also includes: A conflict graph is constructed with trusted anchor points in the data and benchmark set as nodes and fact conflicts, near duplications, and synchronization anomalies as edges. The range of batch contaminated data is located based on community clustering.
[0014] Furthermore, the method also includes: The formal knowledge area and the retrieval tool used for online services are versioned. When a key online indicator is detected to be below a threshold, the formal knowledge area and the retrieval tool are automatically rolled back to the most recent version combination, wherein the comparison execution corresponding to the version combination did not diagnose the source of the anomaly when the version combination was formed.
[0015] Furthermore, the method also includes: Only when all candidate data has been verified and the global anchor offset rate is less than 5%, will a new version of the formal knowledge area be released, containing the candidate data allocated to the formal knowledge area after the aforementioned hierarchical processing.
[0016] Secondly, this invention provides a financial RAG defense system based on trusted anchor conflict detection and continuous querying, comprising: The module includes: financial data collection and version management module, candidate knowledge area, formal knowledge area, trusted anchor point management module, retrieval integrity detection module, financial fact conflict detection module, anomaly impact analysis module, data credibility weight module, continuous query control module, evidence gating and response generation module, and audit log and version rollback module. The financial data collection and version management module is used to write newly collected financial data into the candidate knowledge area; the trusted anchor management module is used to output benchmark samples to the retrieval integrity detection module; the retrieval integrity detection module, the financial fact conflict detection module, and the anomaly impact analysis module are used to obtain risk characteristics; the data trusted weight module is used to calculate the risk score and trusted weight of candidate data based on the risk characteristics, and write low-risk data into the formal knowledge area, set medium-risk data to a downweighted state, and move high-risk data into the isolation area according to the risk score; the continuous query control module is used to perform weighted retrieval in combination with the formal knowledge area, identify unsatisfied fact slots, and generate subsequent queries; the evidence gating and answer generation module is used to control answer generation according to evidence quality standards; the audit log and version rollback module is used to record the entire process log and perform version rollback.
[0017] By adopting the above technical solution, a computer program is generated from the aforementioned financial RAG defense method based on trusted anchor conflict detection and continuous query, and stored in the memory for loading and execution by the processor. This allows for the creation of a terminal device based on the memory and processor, facilitating its use.
[0018] The beneficial effects are as follows: Through the collaborative operation of all modules, isolation verification, retrieval offset detection, financial fact conflict detection, anomaly impact analysis, risk score calculation, and graded handling can be completed before newly collected financial data enters the formal knowledge area, reducing the possibility of risky data directly entering the online retrieval chain; when responding to user financial questions, subsequent queries can be generated based on unmet fact slots and incremental searches can be executed, and answer generation can be restricted when the evidence quality is insufficient. Combined with full-process log recording and version rollback, it can provide a basis for anomaly localization, processing review, and system state recovery, improving the stability of the financial RAG system and the verifiability of question and answer results.
[0019] Compared with the prior art, the present invention has at least the following technical effects: 1. Pre-emptive isolation and verification effectively limit contamination from entering the online environment: Existing technical data is directly entered into the online index, resulting in delayed exposure of contamination; all new data in this invention undergoes full-dimensional verification in the candidate isolation area, with only low-risk data entering the formal index, thus limiting the scope of contamination impact from the source.
[0020] 2. Multi-feature fusion risk assessment, covering covert poisoning scenarios: Existing methods rely solely on source whitelists and static similarity thresholds, which cannot identify batch tampering, misuse of authoritative accounts, or cross-domain problem poisoning; This invention integrates factual conflicts, anchor point offsets, and cross-problem coverage to quantify risks from multiple dimensions, thereby improving the detection range.
[0021] 3. Automatic differentiation of dual anomaly sources and repair of retrieval tampering: Existing technologies cannot distinguish between two types of attacks: knowledge base pollution and retrieval parameter tampering. This invention identifies retrieval anomalies through multi-anchor point synchronous offset features and automatically switches to a backup retrieval, eliminating the need for manual model restart.
[0022] 4. Continuous query to supplement evidence and reduce model error output: Existing one-time retrieval still generates answers even when evidence is missing or conflicting; this invention iterates and supplements data from multiple independent sources, and uses evidence gating to intercept unfounded conclusions, reducing the error rate of investment analysis.
[0023] 5. Full-chain automated version closed loop, adapted to financial compliance: Existing detection, handling, logging, and rollback are fragmented; this invention integrates a versioned knowledge base, retrieval tool, full audit logs, version rollback module, and one-click rollback, meeting the compliance requirements of data traceability and risk handling in the financial industry.
[0024] 6. Lightweight engineering implementation helps reduce system modification and deployment costs: No pre-training or fine-tuning of large language models is required; it supports hybrid retrieval and multiple implementation schemes for rule / lightweight models; and it can be deployed with small to medium computing power clusters. Attached Figure Description
[0025] Figure 1 This is a schematic diagram of the overall structure of the system of the present invention.
[0026] Figure 2 This is a schematic diagram of the data access and continuous query process of the method of the present invention. Detailed Implementation
[0027] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0028] Example 1: Overall System Structure like Figure 1 As shown, the financial RAG defense system of the present invention consists of the following 11 independent and distributably deployable modules: M1 Financial data collection and version management module, M2 Candidate knowledge area, M3 Formal knowledge area, M4 Trusted anchor management module, M5 Retrieval integrity detection module, M6 Financial fact conflict detection module, M7 Anomaly impact analysis module, M8 Data trust weight module, M9 Continuous query control module, M10 Evidence gating and response generation module, and M11 Audit log and version rollback module.
[0029] The system workflow is as follows: After standardized data collection is collected by the M1 Financial Data Collection and Version Management module, it is written into the M2 Candidate Knowledge Area; the M4 Trusted Anchor Management module synchronously outputs benchmark samples to the M5 Retrieval Integrity Detection module; the M5 Retrieval Integrity Detection module, the M6 Financial Fact Conflict Detection module, and the M7 Anomaly Impact Analysis module jointly output risk characteristics to the M8 Data Trust Weighting module. The M8 Data Trust Weighting module calculates the risk score and trust weight of the candidate data based on the risk characteristics, and classifies the candidate data according to the risk score, writing low-risk data into the M3 Formal Knowledge Area, setting medium-risk data to a downweighted state, and moving high-risk data into the isolation area; the user's financial questions enter the M9 Continuous Query Control module, which completes the weighted retrieval in conjunction with the M3 Formal Knowledge Area; the retrieval results update the evidence status and unmet fact slots, and are sent to the M10 Evidence Gating and Response Generation module to output compliant responses. At the same time, the entire process log is stored in the M11 Audit Log and Version Rollback module, which supports manual review and version rollback.
[0030] The key storage area specifications are as follows: The M2 candidate knowledge area has an independent vector index and independent version number, used only for admission verification and prohibited from online Q&A access. Stored fields include data ID, source identifier, original hash, collection time, publication time, financial entity, reporting period, text block, vector, original source weight, trusted weight, and processing status. The M3 formal knowledge area has multiple version indexes coexisting; only the currently effective version is loaded online, and only low-risk data that has passed risk verification is stored. The isolation area is subordinate to the M2 candidate knowledge area; high-risk data is permanently isolated and readable only by manual review.
[0031] The standard fields of the M4 Trusted Anchor Management Module include: benchmark financial question, set of trusted data IDs, standardized key fact triples, benchmark TopK search list, benchmark similarity, anchor unique identifier, creation time, expiration time, and last verification time.
[0032] The anchor point lifecycle management process includes anchor point generation, periodic self-inspection, expired anchor point elimination, and incremental iteration, as detailed below: Anchor point generation: During the initial deployment, the system administrator selects a standard question set covering core scenarios in the financial field (including categories such as financial analysis, valuation comparison, risk events, and industry comparison), and uses official reports issued by authoritative financial institutions as credible data to extract standardized key financial fact triples (financial entity - financial indicator - reporting period) to generate an initial set of credible anchor points. Each anchor point is assigned a unique identifier and its creation time is recorded.
[0033] Regular self-check: The system performs a self-check process at regular intervals, performing a search operation only in the formal knowledge area for each valid anchor point, comparing the current search results with the benchmark TopK list, and marking the anchor point as abnormal if there is a ranking shift or a significant change in similarity distribution, and writing it into the audit log to trigger an operation and maintenance alarm.
[0034] Expired and discarded: Each anchor point has a validity period. Anchor points that have exceeded the validity period are automatically marked as expired and will no longer participate in offset detection. Expired anchor points are retained in the database for historical tracking, but they are not included in the online detection process.
[0035] Incremental Iteration: When the formal knowledge area completes the release of a new version and the number of newly added low-risk data reaches the preset amount, the system automatically triggers the anchor point incremental iteration process: on the basis of the existing benchmark test set, standard questions covering the newly added financial entities or reporting periods in the new data are added, new credible anchor points are generated and added to the anchor point library, ensuring that the benchmark test set expands synchronously with the growth of the knowledge base and always maintains effective coverage of the current knowledge base.
[0036] Example 2: New Data Access and Risk Verification Process like Figure 2 As shown, the data access and continuous query process of this invention specifically includes the following steps: S101 Standardized Data Entry Candidate Knowledge Area: Collects multi-source financial data, standardizes fields, calculates full-text hash values to prevent tampering, binds original files, parsed text, and vector blocks one by one, and writes them into the candidate knowledge area to generate independent indexes to be verified. S102 Duplicate Data Merging and Marking: Based on original text hash, vector near-duplicate, and subject + reporting period triple matching, duplicate data is marked and merged for unified verification.
[0037] S103 Trusted Anchor Point Retrieval Shift Detection: Two sets of searches are executed in parallel—only the formal knowledge area index and the formal index plus candidate indexes to be verified. Anchor point shift features are calculated, including the magnitude of the drop in trusted data ranking, the rate of change in the TopK result set, the similarity distribution shift, and the difference in key fact coverage. The determination is based on the range of the proportion of trusted anchor points with ranking drops to the total number of trusted anchor points: if the proportion of trusted anchor points with ranking drops to the total number of trusted anchor points is not less than 80%, it is determined to be an abnormal retrieval parameter tampering; if at least one trusted anchor point experiences a ranking drop, and the proportion of trusted anchor points with ranking drops to the total number of trusted anchor points is less than 80%, it is determined to be candidate data contamination.
[0038] S104 Financial Fact Conflict Detection and Multi-Dimensional Risk Scoring: Extract standardized financial fact units and construct multi-dimensional risk features based on multiple risk feature dimensions.
[0039] The risk score formula is: ; in, This indicates the risk score of the candidate data; This represents the Sigmoid normalization function, used to map the weighted calculation result to the range of values from 0 to 1; Indicates the first weight; This indicates factual conflict characteristics, used to characterize the degree of inconsistency between candidate data and credible data under the same financial entity, financial indicators, and reporting period; Indicates the second weight; This indicates the anchor point ranking offset feature, which is used to characterize the degree of decline in the retrieval ranking of reliable data after candidate data is added to the index to be verified; Indicates the third weight; This indicates cross-question anomaly coverage features, used to characterize the coverage range of candidate data that causes abnormal impacts on the search results for different financial questions; Indicates the fourth weight; This indicates version inconsistency, used to characterize the degree of inconsistency between candidate data and verified data versions, financial entities, and reporting periods; Indicates the fifth weight; The source integrity feature is used to characterize the completeness of source information such as source identifier, original hash, disclosure date, and publishing entity of candidate data.
[0040] In one embodiment, the parameter value ; ; ; ; The weight values mentioned above are determined based on multiple rounds of cross-validation and expert experience in common scenarios in the financial field: factual conflict features and anchor ranking offset features have the highest discriminative power in poisoning detection, and are therefore assigned high weights (0.30 and 0.25); cross-issue anomaly coverage features can reflect the breadth of the impact of contaminated data, and are assigned medium weights (0.20); version consistency features and source integrity features are used as auxiliary discrimination dimensions and are assigned low weights (0.10 and 0.15). The above weight values can be adaptively adjusted according to specific business scenarios in actual deployment.
[0041] Confidential weight update formula: ; in, Indicates the credibility weight of candidate data; This indicates the basic weight of the source, which is pre-set based on the authority of the publishing institution (e.g., 1.0 for the China Securities Regulatory Commission and stock exchanges, 0.8 for securities research institutions, and 0.5 for financial media). This represents the file hash integrity coefficient. It is 1.0 when the SHA-256 hash value of the candidate data matches the hash value recorded during collection, and 0 when they do not match (indicating that the file has been tampered with). The timeliness matching coefficient is calculated based on the difference between the data disclosure date and the current date, η=e^(-λ·Δt), where Δt is the difference in the number of days between the current date and the disclosure date, and λ is a preset decay factor (in one embodiment, λ=0.005, that is, η≈0.37 after about 200 days, which corresponds to the timeliness decay law that is usually used in the financial field with annual reports as the reference period).
[0042] The correlation between candidate data and trusted anchors is analyzed to pinpoint the scope of batch contaminated data. Specifically, a conflict graph is constructed, with data and anchors as nodes, and factual conflicts, near-duplication, and synchronization anomalies as edges. Community clustering is used to locate the scope of batch contaminated data. The conflict graph is an undirected graph G=(V,E), where V is the set of nodes, containing data nodes (one node for each candidate data and one for each trusted data being compared) and anchor nodes (one node for each trusted anchor); E is the set of edges, used to represent the correlation between nodes. The edge types and edge construction rules are as follows: Fact Conflict Edge: When there are inconsistencies between candidate data and credible data regarding the same financial entity, financial indicators, or factual values under the same reporting period, a fact conflict edge is established between the corresponding candidate data node and credible data node.
[0043] Near-repeating edge: When the original hash values of two documents are the same or the vector similarity exceeds a preset threshold (such as 0.95), a near-repeating edge is established between the corresponding nodes.
[0044] Synchronization anomaly edge: When the same candidate data causes a drop in the ranking of credible data in multiple benchmark financial problems, a synchronization anomaly edge is established between the candidate data node and the anchor node involved.
[0045] After the graph is constructed, a community detection algorithm (such as the Louvain algorithm or the Leiden algorithm) is used to partition the graph G into communities, dividing the nodes into several data clusters. For each data cluster, if the following conditions are met simultaneously: it contains at least one candidate data node; it contains at least one trusted data node or trusted anchor node; and there is at least one synchronization anomalous edge between the candidate data node and the trusted anchor node, then the data cluster is determined to be part of the batch contaminated data range.
[0046] It should be noted that fact conflict characteristics are calculated separately for each candidate document. Anchor point ranking offset features Cross-problem anomaly coverage characteristics Version inconsistency features and source integrity characteristics and the characteristics of factual conflict Anchor point ranking offset features Cross-problem anomaly coverage characteristics Version inconsistency features and source integrity characteristics The value of is normalized to the interval between zero and one.
[0047] Factual Conflict Characteristics The calculation method is as follows: Standardized financial fact units in the candidate data are compared with standardized financial fact units in the credible data that share the same financial entity, financial indicators, and reporting period. The ratio of the number of inconsistent standardized financial fact units to the total number of standardized financial fact units being compared is determined as the fact conflict characteristic. When there are no standardized financial fact units for comparison, the characteristics of fact conflict exist. It is zero.
[0048] Anchor point ranking offset features The calculation method is as follows: record the retrieval ranking of credible data before and after the candidate data is added to the index to be verified; calculate the credible data ranking decline based on the retrieval ranking before and after the credible data is added to the index to be verified; and normalize the average credible data ranking decline corresponding to each credible anchor point to determine the anchor point ranking shift feature. .
[0049] Cross-problem anomaly coverage features The calculation method is as follows: count the number of benchmark financial issues that show a drop in the ranking of credible data, a change in the TopK result set, or a decrease in the coverage of key facts after candidate data is added to the index to be verified, and determine the cross-issue abnormal coverage feature by the ratio of the number of benchmark financial issues obtained from the statistics to the number of benchmark financial issues included in the preset benchmark test set. .
[0050] Version inconsistency features The calculation method is as follows: compare the candidate data with the verified data in the formal knowledge area, and determine whether the data version, financial entity, and reporting period are consistent. The ratio of the number of inconsistent items to the number of items involved in the judgment is determined as the version inconsistency feature. .
[0051] Source integrity characteristics The calculation method is as follows: determine whether the source identifier, original hash, disclosure date, and publishing entity of the candidate data are complete, and determine the ratio of the number of complete items to the number of items participating in the judgment as the source integrity feature. .
[0052] S105 Data Classification and Official Index Release: Configuring Two-Level Risk Thresholds and ;in, This indicates the first-level risk threshold; This represents the second-level risk threshold. Low-risk data is written to the formal knowledge area; medium-risk data enters a downweighted state; high-risk data is moved to the isolation area. In this invention, the global anchor offset rate is used to quantify the overall offset degree of all trusted anchors, defined as: the percentage of the number of trusted anchors in the benchmark set whose ranking has dropped, to the total number of trusted anchors in the benchmark set; the corresponding calculation formula is as follows: Global anchor offset rate = (number of trusted anchors whose ranking has dropped / total number of trusted anchors) * 100%. A new version of the formal knowledge area is allowed to be released only when all candidate data has been verified and the global anchor offset rate is less than 5%.
[0053] In this invention, key thresholds are determined by balancing the false negative and false positive rates under a financial RAG poisoning attack scenario. An 80% threshold is used for retrieval anomaly detection. Retrieval parameter tampering generally causes a large number of global anchor point shifts, while candidate data contamination typically only causes localized anchor point shifts. This threshold distinguishes between these two types of anomalies, striking a balance between avoiding misjudging data contamination as retrieval malfunction and avoiding misjudging retrieval tampering as data contamination. A 5% global anchor point shift rate threshold is set for new official knowledge base releases, allowing for a small number of normal business fluctuations in anchor points while filtering out risky versions with global disturbances, achieving a balance between version update frequency and online service stability. Two-level risk scoring thresholds, τ1=0.30 and τ2=0.65, comprehensively balance the two indicators of missed contaminated data and mis-isolation of normal data, thus distinguishing between low, medium, and high-risk data. A minimum evidence gating credibility weight threshold of 0.4 is used to filter data with extremely low source credibility, tampered file hashes, or severely expired information, retaining qualified business data for question-and-answer generation. The specific thresholds mentioned above can be adaptively configured according to the risk tolerance of the business scenario, and this invention does not limit them to a single value.
[0054] Example 3: Continuous Query and Evidence Gating Generation S106 Weighted Hybrid Search: The formula for the comprehensive score of a single round of search is: ; in, This represents the overall score for a single round of retrieval; This represents the normalized hybrid retrieval score, with a value range of [0,1]. This score is obtained by weighted fusion of the dense vector retrieval score and the sparse vector retrieval score. This represents the confidence weight coefficient, which is used to control the adjustment range of the confidence weight on the final ranking score; This represents the credibility weight of the candidate data. In one embodiment, This value is the result of grid search optimization based on a benchmark set containing 200 trusted anchors (search range 0.1~0.9, step size 0.05, with anchor pass rate as the optimization objective). Cross-validation confirms that this value can effectively improve the ranking of trusted information in the search results without significantly reducing the recall rate of relevant information. Resource control: Maximum number of consecutive query rounds per user session is 10 rounds, and the concurrent query rate is limited to 20 times per minute.
[0055] S107 Evidence Update and Identification of Unmet Fact Gap: An unmet fact gap refers to a missing mandatory information unit before generating a credible investment conclusion. This includes financial indicator values (such as net profit, operating revenue, debt-to-equity ratio, etc.), comparative reporting periods (year-on-year or quarter-on-quarter data from the previous or same period last year), independent disclosure sources (at least two independent authoritative information sources), risk events (such as major litigation, regulatory penalties, changes in controlling shareholders, etc.), and correction announcements (if there are historical corrections, the corrected data must be included). Automatic identification rules for unmet fact gaps include, but are not limited to: lack of multi-quarter comparisons of the same indicator, fewer than two independent disclosure sources, missing correction announcements, missing key financial indicators, and incomplete reporting periods. When any type of fact gap is unmet, the system identifies it as an evidence gap and triggers incremental retrieval to fill it.
[0056] S108 Continuous Query Vector Iterative Generation: The user's original question, the retrieved evidence summary, and the text describing the evidence gap are concatenated. The concatenated result is encoded using an embedding model to generate an iterative query vector. Incremental retrieval is then performed on the formal knowledge area based on the iterative query vector. Termination conditions include the evidence coverage rate reaching a preset coverage threshold, no new credible facts being retrieved for a preset number of consecutive rounds, or reaching a preset maximum number of query rounds. In a specific embodiment, the evidence coverage rate is 90%.
[0057] S109 Evidence Gating Generation Control: The release conditions are that the credibility weight of the data involved in the generation is ≥0.4, there are at least two independent information sources for the same indicator, and there are no unresolved key fact conflicts. When all release conditions are met, the evidence gating and response generation module generates financial Q&A results with data identifiers, sources, and disclosure dates. When any release condition is not met, the evidence gating and response generation module outputs an insufficient evidence prompt and lists unmet fact slots and conflicting data items.
[0058] Example 4: Audit Logs, Manual Review, and Version Rollback It should be noted that version control and automatic rollback for anomalies are enhancements and optimizations of this invention for financial compliance scenarios. Those skilled in the art can choose to enable or disable this function based on the compliance requirements of actual business. Even without deploying version control and automatic rollback for anomalies, this invention can still complete the core business processes of candidate knowledge area isolation and verification, attack behavior identification, data risk classification and handling, continuous query for evidence supplementation, and evidence gating to intercept erroneous output.
[0059] The audit log and version rollback module record all fields including: document version, anchor version, retrieval version, risk score, handling result, query vector for each round, retrieval TopK list, model output content, and operator ID. Audit logs support permanent retention; the retention period and access permissions are configured according to financial industry compliance requirements, supporting full retention for at least the legally mandated minimum retention period, meeting the compliance requirements for log integrity and traceability at Level 3 and above of the Information Security Protection System. Log access is subject to access control isolation; only audit roles are authorized to read the full logs, while operations and maintenance roles can only view operational logs. The standardized manual review process includes automatically generating review work orders for data in the isolation area. Review conclusions are categorized as false alarms or confirmed contamination. When the review conclusion is a false alarm, the system automatically restores the relevant data from the isolation area to the candidate knowledge area, re-executes the risk assessment process, and simultaneously cancels the alarm record triggered by the data. When the review conclusion confirms contamination, the system automatically locates other data with the same source association as the contaminated data based on near-duplicate edges and synchronous abnormal edges in the conflict graph. It then performs linked isolation marking on the data with the same source to prevent omission of associated contaminated data. Automatic rollback mechanism: The system monitors the anchor point pass rate and question-answer conflict rate online in real time. When these indicators fall below a preset threshold, it automatically switches the knowledge base and search engine to the most recently validated version.
[0060] Example 5: Complete Financial Data Example Taking the malicious falsification and poisoning of a listed company's annual report as an example, the complete defense process of this invention is explained: Attackers submitted a forged PDF of a listed company's annual report through a stolen authoritative institution account. This document was standardized and written into the candidate knowledge area to build an independent index to be verified. At this time, the online official knowledge area was not modified.
[0061] The system executes two sets of searches in parallel: one for the formal knowledge area only and one for the formal index plus candidate indexes. The preset benchmark set contains 50 trusted anchors. Detection revealed that after the forged annual report was added to the candidate index, the ranking of trusted materials corresponding to 43 anchors dropped significantly. That is, the proportion of trusted anchors with a drop in ranking is 43 / 50=86%, which is not lower than the 80% threshold. The system first judged it as an abnormal tampering of the searcher parameters and automatically switched to the most recently verified searcher version to continue the detection.
[0062] After switching to the backup search engine and re-executing the search offset detection, it was found that only 12 anchor points experienced a drop in ranking, accounting for 12 / 50=24%, which is lower than 80% and greater than 0. This was determined to be candidate data contamination, and the process was initiated into the conflict detection process.
[0063] Taking standardized financial fact units as an example, using net profit as an indicator, the candidate data records a net profit of 720 million yuan, while the credible data of the same financial entity in the same reporting period records a net profit of 1.25 billion yuan, indicating a factual conflict. The value is 1.0; Anchor point ranking offset feature. After normalization, the value is 0.85; this data has an anomalous impact on retrieval for five different financial questions, exhibiting anomalous coverage characteristics across questions. The value is 0.5; the version and main information are basically consistent with the verified data. The value is 0.2; the source information integrity check passed. The value is set to 0.1. Substituting this into the risk scoring formula: ; After Sigmoid normalization, S≈0.65. Since S=0.65≥ =0.65, the data is judged to be high risk.
[0064] Based on the aforementioned risk assessment results, the falsified annual report was moved to the isolation zone, and a manual review work order was automatically sent, marking the conflict points and anchor point offset data. Due to the presence of high-risk data and the global anchor point offset rate (12 / 50=24%) exceeding 5%, this version was not released to the official knowledge area.
[0065] While contaminated data is in the isolation zone, when a user asks "What was the net profit of a certain company in 2024?", the system performs two rounds of incremental retrieval based on the unmet fact slots. Only authoritative and authentic annual report data from the formal knowledge area is retrieved. After the retrieval results are confirmed by evidence gating to have a credibility weight of ≥0.4 for all data involved in the generation, three independent sources for the same indicator, and no unresolved key fact conflicts, the correct net profit value of "1.25 billion yuan" with source citations is generated. The output includes the data ID, source organization name, and disclosure date.
[0066] To verify the technical effectiveness of this invention, the system prototype constructed according to embodiments one through five above was validated on a benchmark test set containing 200 trusted anchor points. During the validation process, a knowledge injection attack scenario was simulated using 15,000 financial documents as the basic knowledge base, and comparisons were made using a baseline solution without defense, a static defense solution, and the solution of this invention. Validation metrics included data-level contamination detection rate, question-answering accuracy, insufficient evidence rejection rate, anchor point pass rate, retrieval anomaly detection rate, and average number of evidence completion rounds.
[0067] Verification results show that the present invention can effectively identify contaminated data in candidate knowledge areas and block it from the formal knowledge area. It can correctly reject answers and trigger incremental retrieval to supplement evidence when evidence is insufficient. Furthermore, it can automatically switch to a backup retrieval system when the retrieval parameters are tampered with. Overall, the present invention has significant effects in defending against covert poisoning attacks and ensuring the accuracy and reliability of question answering in financial RAG systems.
[0068] This invention is not limited to the preferred embodiments described above. Without altering the core logic of this invention—namely, candidate knowledge area isolation and verification, dual-path retrieval comparison of trusted anchor points to distinguish between retrieval tampering and candidate data contamination, multi-dimensional risk scoring and graded handling, continuous querying driven by unmet fact slots, and evidence gating—those skilled in the art can employ various alternative implementation methods. Regarding the retrieval module, the aforementioned embodiments employ a hybrid retrieval of dense vectors and BM25 sparse retrieval. Those skilled in the art can also employ other types of dense and sparse retrieval combinations, or select different re-ranking algorithms, as long as the ranking comparison of trusted data and candidate data can be achieved. The specific retrieval and re-ranking algorithm selection can be adaptively determined based on the computing resources and accuracy requirements of the actual deployment environment; this invention does not impose a unique limitation on this. For the financial fact conflict detection module, the aforementioned embodiments use rule extraction to standardize financial fact units to complete fact conflict comparison. Those skilled in the art can also use other text matching or natural language reasoning methods to achieve consistency determination of fact units, as long as the fact conflict feature c1 can be output for subsequent risk scoring calculation. The specific implementation method can be adaptively determined based on the actual data format and accuracy requirements; this invention does not impose a unique limitation on this. For continuous query iteration, in addition to the aforementioned lightweight approach—that is, concatenating the user's original question, the summary of retrieved evidence, and the text describing the evidence gaps, and generating the iterative query vector through embedding model encoding—a deep optimization approach can also be adopted. This approach directly outputs the iterative query vector from the hidden state of the large model, without needing to concatenate the data before feeding it into the embedding model. Both approaches can iteratively update the query vector based on unsatisfied fact slots, thus completing incremental evidence supplementation. All of the above alternative implementations can achieve the inventive objective of this invention and fall within the protection scope of this invention.
[0069] It should be noted that in this invention, relational terms such as first and second (number one, number two) are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations.
[0070] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the claimed invention.
Claims
1. A financial RAG defense method based on trusted anchor conflict detection and continuous query, characterized in that, include: Newly collected financial data is identified as candidate data and stored in a candidate knowledge area, which is isolated from the formal knowledge area used to store financial data that has been risk-verified and has a credible weight. Based on a preset benchmark test set containing trusted anchors, a first retrieval operation is performed to retrieve the formal knowledge region, and a second retrieval operation is performed to retrieve both the formal knowledge region and the candidate knowledge region. The retrieval results of the first retrieval operation and the second retrieval operation are then compared. Based on the difference in the results of the first and second search operations, and according to the range of the proportion of the number of trusted anchors with a drop in ranking to the total number of trusted anchors, if trusted anchors also experience a drop in ranking, it is determined to be an abnormal tampering of searcher parameters. If only some trusted anchor points shift, it is determined that the candidate data is contaminated; When candidate data is determined to be contaminated, the correlation between candidate data and trusted anchor points is analyzed to determine the range of contaminated data in batches. The risk score of each candidate data is calculated based on multiple risk feature dimensions using a risk assessment model, and the trusted weight of each candidate data is calculated. The candidate data is then classified and processed according to the risk score, and low-risk data is written into the formal knowledge area. The system receives financial questions from users, performs a hybrid search in conjunction with the formal knowledge area, updates the evidence status and unsatisfied fact slots based on the search results, iteratively updates the query vector based on the unsatisfied fact slots, and performs incremental search to supplement the evidence. The search results obtained from incremental retrieval are sent to the evidence gating and response generation module, which determines whether the credibility weight of the generated data, the independent information source, and the unresolved key factual conflicts meet the release conditions.
2. The financial RAG defense method based on trusted anchor conflict detection and continuous query as described in claim 1, characterized in that, The simultaneous ranking decline of trusted anchors means that the number of trusted anchors with a ranking decline accounts for no less than 80% of the total number of trusted anchors in the preset benchmark test set; the offset of only some trusted anchors means that at least one trusted anchor has a ranking decline, and the number of trusted anchors with a ranking decline accounts for less than 80% of the total number of trusted anchors; after determining that the retriever parameter tampering is abnormal, the current retriever is switched to the most recently verified retriever version or the BM25 sparse backup retriever.
3. The financial RAG defense method based on trusted anchor conflict detection and continuous query as described in claim 1, characterized in that, The risk assessment model calculates the risk score based on factual conflict characteristics, anchor ranking offset characteristics, cross-issue anomaly coverage characteristics, version inconsistency characteristics, and source integrity characteristics.
4. The financial RAG defense method based on trusted anchor conflict detection and continuous query as described in claim 1, characterized in that, The tiered processing includes: writing low-risk data into the formal knowledge area, setting medium-risk data to a downweighted state, and moving high-risk data into the isolation area.
5. The financial RAG defense method based on trusted anchor conflict detection and continuous query as described in claim 1, characterized in that, The process of generating subsequent queries includes: concatenating the user's original question, the retrieved evidence summary, and the text describing the evidence gap, and generating an iterative query vector through an embedding model encoding.
6. The financial RAG defense method based on trusted anchor conflict detection and continuous query as described in claim 1, characterized in that, The preset evidence quality standards include: The credibility weight of the materials used to generate the answer is higher than a preset threshold; The key facts are supported by at least two independent sources; and there are no unresolved conflicts of key facts in the set of evidence.
7. The financial RAG defense method based on trusted anchor conflict detection and continuous query as described in claim 1, characterized in that, The method further includes: A conflict graph is constructed with trusted anchor points in the data and benchmark set as nodes and fact conflicts, near duplications, and synchronization anomalies as edges. The range of batch contaminated data is located based on community clustering.
8. The financial RAG defense method based on trusted anchor conflict detection and continuous query as described in claim 1, characterized in that, The method further includes: The formal knowledge area and the retrieval tool used for online services are versioned. When a key online indicator is detected to be below a threshold, the formal knowledge area and the retrieval tool are automatically rolled back to the most recent version combination, wherein the comparison execution corresponding to the version combination did not diagnose the source of the anomaly when the version combination was formed.
9. The financial RAG defense method based on trusted anchor conflict detection and continuous query as described in claim 1, characterized in that, The method further includes: Only when all candidate data has been verified and the global anchor offset rate is less than 5%, will a new version of the formal knowledge area be released, containing the candidate data allocated to the formal knowledge area after the aforementioned hierarchical processing.
10. A financial RAG defense system based on trusted anchor conflict detection and continuous query, characterized in that, include: The module includes: financial data collection and version management module, candidate knowledge area, formal knowledge area, trusted anchor point management module, retrieval integrity detection module, financial fact conflict detection module, anomaly impact analysis module, data credibility weight module, continuous query control module, evidence gating and response generation module, and audit log and version rollback module. The financial data collection and version management module is used to write newly collected financial data into the candidate knowledge area; the trust anchor management module is used to output benchmark samples to the retrieval integrity detection module; the retrieval integrity detection module, the financial fact conflict detection module, and the anomaly impact analysis module are used to obtain risk characteristics; the data trust weight module is used to calculate the risk score and trust weight of candidate data based on the risk characteristics, and classify the candidate data according to the risk score, writing low-risk data into the formal knowledge area, setting medium-risk data to a downweighted state, and moving high-risk data into the isolation area; The continuous query control module is used to perform weighted retrieval in conjunction with the formal knowledge area, identify unsatisfied fact slots, and generate subsequent queries; the evidence gating and answer generation module is used to control answer generation according to evidence quality standards; and the audit log and version rollback module is used to record full-process logs and perform version rollback.
