Large model sensitive information filtering method based on RAG and Agent
By building a dynamic sensitive information vector library and combining RAG architecture and Agent agents, the static rules limitations and insufficient semantic understanding of large-model sensitive information filtering technology are solved, and high-precision and low-latency sensitive information recognition and dynamic adaptability are achieved, which is suitable for dialogue systems and content generation platforms.
Patent Information
- Application Number
- CN202510543244.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-08-19
AI Technical Summary
The existing large-model sensitive information filtering technology has limitations in static rules, insufficient semantic understanding, efficiency bottlenecks and update lag problems, making it difficult to adapt to the compliance requirements of dynamic changes.
A dynamic sensitive information vector library is constructed, combining RAG architecture and Agent agents, and through vector similarity matching and context analysis, sensitive information is identified and filtered in real time, supporting semantic-level sensitive content representation and rapid retrieval, and using an automated update mechanism to adapt to semantic evolution.
It realizes high-precision and low-latency sensitive information recognition, with an identification accuracy of more than 98%, supports cross-language and complex metaphorical scenarios, dynamically adapts to new sensitive words, and meets the needs of real-time generation.
Smart Images

Figure CN120508693A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the intersection of artificial intelligence and information security technology, and in particular to a large-model sensitive information filtering method based on RAG and Agent. Background Art
[0002] Existing large-scale sensitive information filtering technologies mainly rely on keyword matching or rule engines, which have the following flaws:
[0003] Limitations of static rules: Unable to adapt to newly emerging sensitive words or semantic variations (such as homophones and abbreviations);
[0004] Insufficient semantic understanding: high misjudgment rate of context-sensitive content (such as metaphors and polysemous words);
[0005] Efficiency bottleneck: Massive sensitive word libraries cause real-time filtering delays, affecting generation speed;
[0006] Update lag: Relying on manual maintenance of sensitive word lists makes it difficult to cope with dynamically changing compliance requirements.
[0007] Some solutions attempt to incorporate machine learning models, but they still face challenges with poor model generalization and high computational resource consumption. Therefore, an efficient, dynamic, and semantically aware sensitive information filtering solution is urgently needed. Summary of the Invention
[0008] In order to solve the above technical problems, the present invention provides a large model sensitive information filtering method based on RAG and Agent.
[0009] The technical solution of the present invention is:
[0010] A large-model sensitive information filtering method based on RAG and Agent solves the problem of capturing and filtering sensitive information in input and output when using large language models. By building a dynamic sensitive information vector library, it supports semantic-level sensitive content representation and rapid retrieval. It combines the RAG architecture to enhance the context-awareness of the generative model and identify implicit sensitive information. It uses Agent intelligence to achieve real-time multi-dimensional analysis of generated text, reducing the misjudgment rate, and providing a key solution for intelligent applications in highly sensitive scenarios.
[0011] Further,
[0012] Build a sensitive information vector library, encode sensitive content into vectors and establish a hierarchical index; retrieve context-related sensitive vectors through the RAG architecture during the input and output process; have the agent perform semantic matching and context analysis, and dynamically filter sensitive tokens; and automatically update the sensitive information vector library based on feedback data.
[0013] The sensitive information vector library is constructed using pre-trained language model encoding and is clustered and stored according to sensitive categories.
[0014] Combining vector similarity and context analysis, it is used in dialogue systems and content generation platforms to support the recognition of cross-language sensitive content and complex metaphor scenarios.
[0015] Going further,
[0016] Construction of sensitive information vector library
[0017] 1) Collect multi-source sensitive data, encode it into vectors through the Embedding model, and store the vector library
[0018] 2) Build a hierarchical index structure, store data in clusters according to sensitive categories, and support efficient nearest neighbor search.
[0019] RAG Enhanced Search
[0020] 1) During the input and output process, contextual key tokens are extracted in real time as search queries;
[0021] 2) Retrieve the Top-K similar sensitive vectors from the vector library to obtain the associated sensitive semantics and expanded word set.
[0022] Agent intelligent filtering
[0023] 1) Semantic matching: Calculate the cosine similarity between the input and output text tokens and the sensitive vector. If it exceeds the threshold, it is marked as sensitive.
[0024] 2) Contextual Analysis: The agent fine-tunes the classification model to determine whether sensitive words appear in the context of violations;
[0025] 3) Dynamic interception: Mask, replace, or terminate the generation of sensitive tokens, and record the violation context to the update module.
[0026] Vector library dynamic update
[0027] 1) Automatically expand the vector library based on user feedback and new compliance requirements;
[0028] 2) Use incremental learning algorithms to optimize vector representations and adapt to semantic evolution.
[0029] The beneficial effects of the present invention are
[0030] High-precision filtering: Combining vector similarity and context analysis, the accuracy of sensitive information identification is increased to over 98%;
[0031] Low-latency response: Hierarchical vector indexing reduces retrieval time to milliseconds, meeting real-time generation requirements.
[0032] Semantic generalization capability: supports the recognition of variant words, cross-language sensitive content, and complex metaphor scenarios;
[0033] Dynamic adaptability: The automated update mechanism enables the system to cope with thousands of new sensitive words added every day. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 It is a schematic diagram of the workflow of the present invention. DETAILED DESCRIPTION
[0035] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0036] The present invention provides a large-model sensitive information filtering method based on RAG (retrieval augmentation generation) and Agent. By constructing a sensitive information vector library, sensitive words and semantically related content are mapped into high-dimensional vectors. Dynamic retrieval enhancement is achieved by combining the RAG architecture, and the Agent intelligent body analyzes the text in real time. Sensitive information is filtered through the dual mechanisms of vector similarity matching and semantic understanding.
[0037] By building a dynamic sensitive information vector library, it supports semantic-level sensitive content representation and rapid retrieval; combining the RAG architecture to enhance the context-awareness of the generation model and identify implicit sensitive information; using agent intelligence to achieve real-time multi-dimensional analysis of generated text, reducing the misjudgment rate, and providing key solutions for intelligent applications in highly sensitive scenarios.
[0038] Step 1: Construction of sensitive information vector library
[0039] 1. Collect multi-source sensitive data (such as regulatory texts and historical violation records), encode them into vectors through an Embedding model (such as the bge-large model), and store them in a vector library (such as Milvus)
[0040] 2. Build a hierarchical index structure, cluster and store sensitive information (such as private information and violent content), and support efficient nearest neighbor search.
[0041] Step 2: RAG Enhanced Search
[0042] 1. During the input and output process, contextual key tokens are extracted in real time as search queries;
[0043] 2. Retrieve the top-K similar sensitive vectors from the vector library to obtain the associated sensitive semantics and expanded word set.
[0044] Step 3: Agent Intelligent Filtering
[0045] 1. Semantic matching: Calculate the cosine similarity between the input and output text tokens and the sensitive vector. If it exceeds the threshold, it is marked as sensitive.
[0046] 2. Contextual Analysis: The agent fine-tunes the classification model to determine whether sensitive words appear in illegal contexts (e.g., "bomb" is legal in military documents but illegal in social conversations);
[0047] 3. Dynamic interception: Mask, replace, or terminate the generation of sensitive tokens, and record the violation context to the update module.
[0048] Step 4: Dynamic update of vector library
[0049] 1. Automatically expand the vector library based on user feedback and new compliance requirements;
[0050] 2. Use incremental learning algorithms (such as online Triplet Loss) to optimize vector representations and adapt to semantic evolution.
[0051] The above description is only a preferred embodiment of the present invention and is only used to illustrate the technical solution of the present invention, and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention are included in the scope of protection of the present invention.
Claims
1. A large model sensitive information filtering method based on RAG and Agent, characterized by: By building a sensitive information vector library, sensitive words and semantically related content are mapped into high-dimensional vectors. Dynamic retrieval enhancement is achieved by combining the RAG architecture. The Agent intelligent body analyzes the text in real time and filters sensitive information through the dual mechanisms of vector similarity matching and semantic understanding.
2. The method according to claim 1, characterized in that Encode sensitive content into vectors and build hierarchical indexes; Retrieve context-sensitive vectors through the RAG architecture during input and output; The agent performs semantic matching and context analysis, dynamically filtering sensitive tokens; Automatically update the sensitive information vector library based on feedback data.
3. The method according to claim 2, characterized in that The sensitive information vector library is constructed using pre-trained language model encoding and is clustered and stored according to sensitive categories.
4. The method according to claim 2, characterized in that Combining vector similarity and context analysis, it is used in dialogue systems and content generation platforms to support the recognition of cross-language sensitive content and complex metaphor scenarios.
5. The method according to claim 1, wherein Construction of sensitive information vector library 1) Collect sensitive data from multiple sources, encode it into vectors through the Embedding model, and store the vector library; 2) Build a hierarchical index structure, store data in clusters according to sensitive categories, and support efficient nearest neighbor search.
6. The method according to claim 1, characterized in that RAG Enhanced Search 1) During the input and output process, contextual key tokens are extracted in real time as search queries; 2) Retrieve the Top-K similar sensitive vectors from the vector library to obtain the associated sensitive semantics and expanded word set.
7. The method according to claim 1, characterized in that Agent intelligent filtering 1) Semantic matching: Calculate the cosine similarity between the input and output text tokens and the sensitive vector. If it exceeds the threshold, it is marked as sensitive. 2) Contextual Analysis: The agent fine-tunes the classification model to determine whether sensitive words appear in the context of violations; 3) Dynamic interception: Mask, replace, or terminate the generation of sensitive tokens, and record the violation context to the update module.
8. The method according to claim 1, characterized in that Vector library dynamic update 1) Automatically expand the vector library based on user feedback and new compliance requirements; 2) Use incremental learning algorithms to optimize vector representations and adapt to semantic evolution.
Citation Information
Patent Citations
Sensitive word auditing method based on large language model, storage medium and electronic equipment
CN116720515A
Sensitive information detection method based on depth model and knowledge base
CN118734842A
Sensitive statement detection method and system
CN119513283A
Dual-prevention intelligent interaction system based on large language model
CN119579365A
Industrial public opinion analysis agent construction method and system based on large language model
CN119886304A
Cited By
Security protection system for authentication based on different types of interfaces
CN121309109A