Artificial intelligence dialogue compliance examination method and system based on local small model

By conducting multi-stage compliance reviews of large language models (LLMs) before user input, during streaming output, and after output, and using local small models (LSMs) for real-time monitoring and interruption, we address the data privacy and security risks and compliance challenges of existing technologies, and achieve efficient and secure content compliance assurance.

CN120687613APending Publication Date: 2025-09-23广东省气象台(南海海洋气象预报中心珠江流域气象台)

Patent Information

Application Number
CN202510699584.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-28
Publication Date
2025-09-23

AI Technical Summary

Technical Problem

Existing technologies, when using large language models (LLMs) for data processing, pose risks to data privacy and security, uncontrollable output content, and "jailbreaking." Furthermore, they lack a unified multi-stage localized review solution, making it difficult to achieve real-time compliance monitoring and interruption.

Method used

A multi-stage compliance review method based on local small models (LSM) is adopted, including real-time review in three stages: before sending, during streaming output, and after output. Multi-level compliance checks are performed on user input and LLM output through preset rules and policies, and immediate intervention is carried out in case of violations.

Benefits of technology

Enhance data security, improve content compliance, achieve real-time risk control, balance capabilities and security, adapt to specific field needs, provide flexibility and auditability, and reduce latency and resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120687613A_ABST
    Figure CN120687613A_ABST
Patent Text Reader

Abstract

The invention provides an artificial intelligence dialogue compliance examination method and system based on a local small model, and the method comprises the steps: obtaining a user input request and related contents, sending the user input request and related contents to the local small model (LSM), and carrying out the examination before sending according to a preset rule; if the content is compliant, sending the content to an external large language model (LLM) to obtain a response; external LLM response content is returned in a streaming mode or a complete mode, the LSM performs real-time examination on each data fragment returned in the streaming mode, if illegal fragments exist, the illegal fragments are processed according to risk levels, and if no illegal fragments exist, the illegal fragments are displayed; and the complete response is directly displayed. The system also performs overall post-review on all contents, and if problems are found, the problems are processed according to risk levels, otherwise, the problems are displayed to users. According to the invention, on one hand, the local small model is deployed to carry out multi-stage compliance examination on the whole process of user input and LLM output, and data privacy protection and content security control are realized; and on the other hand, real-time interruption and cross validation can be performed on high-risk contents, mechanisms such as log recording, objection feedback, service degradation and the like are supported, and the reliability, stability and traceability of system review are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence related technologies, and in particular to an artificial intelligence dialogue compliance review method and system based on a local small model. Background Art

[0002] In recent years, large language models (LLMs) such as OpenAI's GPT series, Google's Gemini, Meta's Llama series, and domestic Qianwen and DeepSeek have made significant progress in natural language processing tasks. They are widely used in multiple industries and fields, including enterprise data processing, meteorology, communications and other highly sensitive data services, for intelligent analysis and content generation.

[0003] There are currently two main modes for applying LLM: Calling external cloud-based LLM services (API model): Users can leverage cloud-based LLMs, which typically have a large number of parameters and greater capabilities. This model offers the advantages of powerful models and rapid knowledge updates. However, it also carries significant inherent risks: Data privacy and security risks: User input (prompt) may contain sensitive information, internal proprietary data, or confidential content (such as unpublished meteorological observation data and internal meeting minutes). This data needs to be transmitted to a third-party server for processing, increasing the risk of data leakage and abuse. This is particularly sensitive in scenarios with strict data protection regulations (such as GDPR, CCPA, HIPAA, etc.) or confidentiality requirements.

[0004] Risk of uncontrollable output content: The output content of external LLM may be unstable, contain "illusions" (generating false information), factual errors, bias, and generate harmful or non-compliant content (such as violating confidentiality regulations, generating inappropriate speech, and leaking privacy in training data).

[0005] Jailbreaking and prompt injection risks: Malicious users may bypass the model's security guardrails through carefully crafted inputs, inducing the model to generate illegal content or perform unintended operations.

[0006] Locally deployed models: usually refer to models with a small number of parameters (Small Language Models, SLMs), which can be run on local servers or terminal devices.

[0007] Advantages: Data does not leave the local environment, privacy and security risks are significantly reduced, response speed may be faster, and it is not restricted by external network connections.

[0008] Disadvantages: The model's capabilities are relatively weak, particularly in complex reasoning, knowledge breadth, following complex instructions, and generating high-quality long texts, often failing to match those of large cloud-based LLMs. While fine-tuning can improve its performance on specific tasks, its general capabilities still lag behind.

[0009] Existing technologies and solutions: To mitigate the risks of calling external LLMs, existing technologies have proposed several methods: Content review API / service: Cloud service providers provide interfaces for classifying text or image content (such as hate, violence, pornography, etc.), which can be called before and after LLM interaction to filter inappropriate content.

[0010] LLM Gateway / API Gateway: Acting as an intermediary between users / applications and LLM services, it centrally manages API keys, performs authentication, rate limiting, load balancing, caching, and logging. Some gateways also integrate content filtering, PII (personally identifiable information) detection, and compliance audit logging.

[0011] Guardrails framework / technology: Through prompt word engineering and rule filtering mechanisms, it blocks inappropriate input, aiming to ensure that LLM output is safe, reliable, and ethical. Problems and shortcomings of existing technologies: Although the above technologies provide different levels of protection, they still have the following shortcomings: External dependencies and privacy risks haven't been completely eliminated: Most content moderation services and LLM gateways are likely still external cloud services, requiring the transmission of user data (even for moderation purposes). Model-based filtering that relies on external models also carries data transmission risks. This is especially true for internal corporate confidential and secret content, which cannot be audited through external interfaces because any form of external transmission poses the risk of leaks.

[0012] Challenges of real-time review of streaming output: LLMs often return results in a streaming format to improve the user experience. However, most existing filtering or review mechanisms only operate after the complete response is generated, making it difficult to detect and interrupt non-compliant content in real time. This can result in users potentially seeing some of the illegal content. While some frameworks (such as Guardrails AI) are beginning to support streaming validation, their implementation and effectiveness rely on the LLM's ability to follow instructions and tend to focus on structural verification rather than complex compliance assessments.

[0013] Lack of a unified, multi-stage localized review solution: Existing technologies are fragmented across different stages (e.g., input filtering only, output review only, or gateway-level policies only). There is no systematic solution that uses a small local model as the core review engine to conduct unified, real-time, closed-loop compliance review across three key stages: pre-user input, during LLM streaming output (including interruptions), and post-output. In particular, the technical solution for real-time streaming monitoring and interruption using a small local model is not yet clear or mature.

[0014] Balance between generality and specialization: General content review tools may not be able to fully understand the professional terminology, standards, and compliance requirements of specific fields.

[0015] Limited handling of internal confidential content: Existing solutions struggle to effectively screen confidential and secret content within an enterprise, as most sensitive enterprise data cannot be audited through external interfaces. Any transfer of sensitive information to external systems for review could violate confidentiality requirements, resulting in fundamental flaws in the handling of confidential content by existing solutions. Summary of the Invention

[0016] The purpose of the present invention is to address at least one of the deficiencies of the prior art and to provide an artificial intelligence dialogue compliance review method and system based on a local small model.

[0017] In order to achieve the above object, the present invention adopts the following technical solutions: Specifically, an AI dialogue compliance review method based on a local small model is proposed, which includes the following: Get user input request and its associated content; Send the associated content to the local LSM, obtain the local LSM's review result of the associated content based on the preset first rule and policy, determine whether there is a pre-sending violation event, and if so, handle it accordingly according to the risk level of the pre-sending violation event; if not, send the associated content to the external LLM; The external LLM responds to the associated content via streaming or complete response; Streaming mode: Obtain the generated content, i.e., multiple data segments, returned by the external LLM in a streaming manner for the associated content, send each data segment to the local LSM, obtain the local LSM's review results of the data segment based on the preset second rule and policy, determine whether there is a data segment violation event, and if so, perform corresponding processing according to the risk level of the data segment violation event; if not, display the data segment content; Complete response mode: directly obtain the content display of the related content from the external LLM; The content display of all data fragments in the streaming mode or the content display in the complete response mode is recorded as the whole content and sent to the local LSM. The local LSM obtains the review results of the related content based on the preset third rules and policies, and determines whether there is an overall content violation event. If so, it is handled accordingly according to the risk level of the overall content violation event. If not, the whole content is displayed to the user.

[0018] Furthermore, the method further comprises: After completing a dialogue compliance review, the user's related content and the review results of each LSM stage will be recorded in the log. The review results include the type and location of the detected problem, and related processing actions. The related processing actions include release, block, interruption, modification, the response content of the external LLM, and the content finally presented to the user.

[0019] Furthermore, the method also includes providing a channel for users to raise objections to the review results to obtain the user's objection request, and when the user's objection request is obtained, processing the user's objection request through manual review.

[0020] Furthermore, the method further comprises: When the local LSM determines that there is a high-risk event among pre-sending violation events, data segment violation events, or overall content violation events, the high-risk event is cross-validated through multiple small models with different architectures to reduce the misjudgment rate.

[0021] Further, specifically, the preset first rules and strategies include: High-risk events, sensitive words and confidential information that are clearly prohibited from being transmitted Medium-risk events may cause external LLM to generate non-compliant content, including misleading instructions or high-risk question patterns, potential prompt injection attacks, and personal privacy data. Low-risk events include input content that is irrelevant to the work content, and duplicate or redundant request content; Corresponding decision-making and processing, For high-risk events, the request is directly blocked and a warning message is returned to the user. For medium-risk events, LSM desensitizes and modifies the request content before submitting it to the user to decide whether to send it. For low-risk events, only risk logs are recorded, prompts are popped up, and the event is sent to the backend.

[0022] Further, specifically, the preset second rules and strategies include: High-risk events: whether sensitive words, confidential information, or inappropriate remarks appear; For medium-risk events, whether there is content that clearly conflicts with known facts or domain knowledge; Low-risk events: whether they comply with predefined output format or style requirements; Corresponding decision-making and processing, High-risk events interrupt the forwarding of subsequent streaming output to the user interface module; For medium-risk events, a preset prompt message is displayed to the user; Low-risk events, record the details of the violation.

[0023] Further, specifically, the preset third rules and strategies include: For high-risk events, the logical consistency and factual accuracy of the overall content will be evaluated, and if obvious errors, false information, or seriously misleading content are found; For medium-risk events, when compared with historical interactions or background knowledge, it is found that some information is inaccurate, the expression is not rigorous enough, or there is content that needs additional explanation. Low-risk events, details such as formatting standards, reference integrity, and the use of professional terminology; Corresponding decision-making and processing, For high-risk events, the complete response is prevented from being displayed to the user, an error message is generated, and the user is advised to ask the question again; For medium-risk events, the content will be revised or supplemented, necessary warning labels will be added, and users will be allowed to view modification suggestions; For low-risk events, the content is marked for manual review, allowing users to view and edit it.

[0024] Furthermore, the method further comprises: Establish a multi-level service degradation strategy to prioritize the execution of core security rules when the system load is too high; Implement redundant deployment of LSM review services to avoid single points of failure; Set resource limits and timeout mechanisms to prevent malicious input from exhausting system resources.

[0025] The present invention also proposes an artificial intelligence dialogue compliance review system based on a local small model, comprising the following: User interface module, an interface for obtaining user input requests and receiving external LLM responses; a local LSM module, configured to examine the results of the associated content based on a first preset rule and policy, examine the results of the data segment based on a second preset rule and policy, and examine the results of the associated content based on a third preset rule and policy; An external LLM interface module, used for calling an external LLM model, and the external LLM model is used for responding to the associated content in a streaming or complete response manner; The control and review middleware is set between the user interface module and the external LLM interface module to coordinate the review process of the local LSM module, manage the information interaction with the external LLM, and perform blocking / release / modification operations; The log and audit module is used to record all interaction requests, review results, and processing actions.

[0026] Furthermore, the system further includes: Fault tolerance and recovery module, which is used to monitor the status of each component of the review system and implement fault detection, degradation strategy and automatic recovery mechanism; The review result feedback module collects user feedback on the review results, and users continuously update the local LSM model and rule base.

[0027] The beneficial effects of the present invention are: The present invention proposes an artificial intelligence dialogue compliance review method and system based on a local small model, which specifically has the following beneficial effects: 1. Enhanced data security: LSM reviews user input before sending, effectively preventing sensitive or confidential information from being sent to external LLMs and reducing the risk of data leakage.

[0028] 2. Improve content compliance: LLM output content is subject to multi-stage review to promptly detect and address false information (illusions), inappropriate remarks, and content that violates professional standards or confidentiality regulations, ensuring output quality and compliance.

[0029] 3. Real-time risk control: The real-time monitoring and interruption mechanism of streaming output can immediately intervene in the process of risk content generation to prevent its complete presentation to users, significantly improving the timeliness and effectiveness of risk prevention and control.

[0030] 4. Balancing Capabilities and Security: This allows users to safely leverage the capabilities of powerful external LLMs to complete complex tasks, while simultaneously controlling security and compliance through local LSMs. This addresses both the security risks of relying solely on external LLMs and the capability bottlenecks of relying solely on small local models.

[0031] 5. Flexibility and auditability: The rule base can be customized according to specific business scenarios (such as meteorological terminology and forecast specifications); complete log records provide a basis for post-audit and accountability.

[0032] 6. Potential efficiency advantages: Using a lightweight local small model for review may have lower latency and resource consumption than using another large model for review. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] The above and other features of the present disclosure will become more apparent through a detailed description of the embodiments shown in conjunction with the accompanying drawings. The same reference numerals in the drawings of the present disclosure represent the same or similar elements. Obviously, the drawings described below are only some embodiments of the present disclosure. It is possible for a person skilled in the art to derive other drawings based on these drawings without inventive effort. In the drawings: Figure 1 Shown is a flow chart of an artificial intelligence dialogue compliance review method based on a local small model of the present invention; Figure 2 Shown is an architectural block diagram of an artificial intelligence dialogue compliance review system based on a local small model of the present invention. DETAILED DESCRIPTION

[0034] The following will be combined with the embodiments and drawings to clearly and completely describe the concept, specific structure and technical effects of the present invention so as to fully understand the purpose, scheme and effect of the present invention. It should be noted that the embodiments and features in the embodiments of this application can be combined with each other unless there is a conflict. The same reference numerals used throughout the drawings indicate the same or similar parts.

[0035] Example 1, with reference to Figure 1 , Figure 1 The method flow of the present invention is presented. It begins with user input and undergoes pre-send review through the LSM. If it does not comply with the rules, it is processed and terminated. If it complies with the rules, it is sent to the external LLM. After receiving the LLM response, LSM real-time streaming review or overall review is performed based on the response type (streaming or complete). If serious violations are found in the streaming, the process is interrupted. If there are problems with the overall response, it is modified or marked. If it complies with the rules, it is directly output. Each link is logged. The present invention proposes an artificial intelligence dialogue compliance review method based on a local small model, including the following: Get user input request and its associated content; Send the associated content to the local LSM, obtain the local LSM's review result of the associated content based on the preset first rule and policy, determine whether there is a pre-sending violation event, and if so, handle it accordingly according to the risk level of the pre-sending violation event; if not, send the associated content to the external LLM; The external LLM responds to the associated content via streaming or complete response; Streaming mode: Obtain the generated content, i.e., multiple data segments, returned by the external LLM in a streaming manner for the associated content, send each data segment to the local LSM, obtain the local LSM's review results of the data segment based on the preset second rule and policy, determine whether there is a data segment violation event, and if so, perform corresponding processing according to the risk level of the data segment violation event; if not, display the data segment content; Complete response mode: directly obtain the content display of the related content from the external LLM; The content display of all data fragments in the streaming mode or the content display in the complete response mode is recorded as the whole content and sent to the local LSM. The local LSM obtains the review results of the related content based on the preset third rules and policies, and determines whether there is an overall content violation event. If so, it is handled accordingly according to the risk level of the overall content violation event. If not, the whole content is displayed to the user.

[0036] In this embodiment 1, starting from the user input, it undergoes LSM pre-send review. If it does not comply with the rules, it is processed and terminated. If it complies with the rules, it is sent to the external LLM. After receiving the LLM response, LSM real-time streaming review or overall review is performed according to the response type (streaming or complete). If serious violations are found in the streaming, it is interrupted. If there is a problem with the overall response, it is modified or marked. If it complies with the rules, it is directly output. Each link is logged. It can solve the problems faced by the existing technology when calling an external large language model (LLM), such as high data security risks, difficulty in ensuring the compliance of output content, and insufficient capabilities of simply using a local small model. Its purpose is to provide a method and system that can utilize the powerful external LLM capabilities while performing multi-stage, real-time compliance review and risk control of interactive content through a locally deployed small model, especially realizing pre-send detection of user input content, real-time streaming monitoring and interruption of LLM output content, and post-output detection, thereby ensuring the safety, controllability, compliance and reliability of the interactive process.

[0037] As a preferred embodiment of the present invention, the method further comprises: After completing a dialogue compliance review, the user's related content and the review results of each LSM stage will be recorded in the log. The review results include the type and location of the detected problem, and related processing actions. The related processing actions include release, block, interruption, modification, the response content of the external LLM, and the content finally presented to the user.

[0038] As a preferred embodiment of the present invention, the method further includes providing a channel for users to raise objections to the review results to obtain the user's objection request, and when the user's objection request is obtained, processing the user's objection request through manual review.

[0039] As a preferred embodiment of the present invention, the method further comprises: When the local LSM determines that there is a high-risk event among pre-sending violation events, data segment violation events, or overall content violation events, the high-risk event is cross-validated through multiple small models with different architectures to reduce the misjudgment rate.

[0040] As a preferred embodiment of the present invention, specifically, the preset first rules and strategies include: High-risk events, where the transmission of sensitive words and confidential information is explicitly prohibited;

[0041] Medium-risk events, Misleading instructions or high-risk question patterns that may cause external LLMs to generate non-compliant content, potential prompt injection attacks, and personal privacy data; Low-risk events include input content that is irrelevant to the work content, and duplicate or redundant request content; Corresponding decision-making and processing, For high-risk events, the request is directly blocked and a warning message is returned to the user. For medium-risk events, LSM desensitizes and modifies the request content before submitting it to the user to decide whether to send it. For low-risk events, only risk logs are recorded, prompts are popped up, and the event is sent to the backend.

[0042] In this preferred embodiment, user input and pre-send check (Pre-SendCheck) are performed a. The user enters a request (Prompt) through the user interface module.

[0043] b. Before sending the request to the external LLM, the control middleware (or user interface module) first submits the request content to the local small model (LSM) module.

[0044] c. LSM reviews user input based on the rules and policy library to check whether it contains: i. Sensitive words and confidential information that are explicitly prohibited from transmission.

[0045] ii. Inductive instructions or high-risk questioning patterns that may cause external LLMs to generate non-compliant content, potential prompt injection attacks, and personal privacy data;

[0046] iii. Potential prompt injection attack.

[0047] d. Decision-making and handling: If LSM detects illegal content, it will: i. Based on the risk level of the preset policy, different processing is performed according to the severity of the level. When a high risk level occurs, the request is directly blocked and a warning message is returned to the user.

[0048] ii. For medium risk levels, LSM desensitizes and modifies the request content before submitting it to the user for decision on whether to send it.

[0049] iii. When the risk level is low, only the risk log is recorded, a prompt pops up, and the log is sent to the backend.

[0050] e. If the LSM determines that the input content is compliant, it allows the request to be sent to the external LLM interface module through the control middleware.

[0051] As a preferred embodiment of the present invention, specifically, the second rules and strategies are preset, including: High-risk events: whether sensitive words, confidential information, or inappropriate remarks appear; For medium-risk events, whether there is content that clearly conflicts with known facts or domain knowledge; Low-risk events: whether they comply with predefined output format or style requirements; Corresponding decision-making and processing, High-risk events interrupt the forwarding of subsequent streaming output to the user interface module; For medium-risk events, a preset prompt message is displayed to the user; Low-risk events, record the details of the violation.

[0052] In this preferred embodiment, when performing external LLM processing and real-time streaming check: a. After receiving the compliance request, the external LLM begins processing and returns the generated content in a streaming manner (for example, word by word or token by token).

[0053] b. The control middleware receives the streaming output data segments from the external LLM.

[0054] c. Key step: The control middleware forwards each received data fragment (or fragments accumulated to a certain length) to the local small model (LSM) module in real time for immediate review.

[0055] d. LSM performs real-time analysis of streaming output content based on the rules and policy library, checking: i. Whether sensitive words, confidential information, inappropriate remarks, etc. appear.

[0056] ii. Whether there is any content that clearly conflicts with known facts or domain knowledge (such as professional terminology and forecasting standards) ("hallucination").

[0057] iii. Whether it complies with the predefined output format or style requirements.

[0058] e. Real-time decision-making and interruption: If the LSM detects serious violations during the streaming output process, the control middleware immediately executes: i. Interrupt forwarding subsequent streaming output to the user interface module.

[0059] ii. Display a preset prompt message to the user (such as "Content generation aborted, potential risk detected").

[0060] iii. Record the details of the violation.

[0061] f. If the LSM real-time review passes, the control middleware forwards the data segment to the user interface module to display it to the user.

[0062] In addition, when performing external LLM processing and real-time streaming check, you can improve efficiency and user satisfaction by adding the following strategies: g. Incremental processing algorithm: For continuous text segments, only the newly added parts are processed to avoid repeated calculations and improve efficiency; h. Progressive interruption: Set multi-level risk thresholds, mark low-risk content before continuing, and interrupt high-risk content immediately; i. Alternative content generation: When streaming output is interrupted, LSM can automatically generate compliant alternative content to maintain user experience.

[0063] As a preferred embodiment of the present invention, specifically, the third rules and strategies are preset, including: For high-risk events, the overall content is evaluated for logical consistency and factual accuracy; For medium-risk events, compare with historical interactions or background knowledge to check for contradictions or omissions; For low-risk events, more complex compliance checks are conducted, such as whether necessary information sources are fully cited and whether specific reporting templates are followed; Corresponding decision-making and processing, For high-risk events, the complete response or part of the question is prevented from being displayed to the user, and a prompt is given; Medium-risk events: attempt to modify or flag the content; Low-risk events mark the content for manual review.

[0064] In this preferred embodiment, after the streaming output (or non-streaming) the overall detection (Post-Stream / Full Response Check): a. When the external LLM completes all content generation (for streaming output, it means receiving all fragments; for non-streaming, it means receiving the complete response at once), the control middleware submits the complete response content to the local small model (LSM) module again.

[0065] b. LSM conducts a more comprehensive review, which may include: i. Evaluate the logical consistency and factual accuracy of the overall content (based on LSM capabilities).

[0066] ii. Compare with historical interactions or background knowledge to check for contradictions or omissions.

[0067] iii. Conduct more complex compliance checks, such as whether necessary information sources are fully cited and whether specific reporting templates are followed.

[0068] c. Final Decision and Action: If LSM detects violations or problematic content, it will: i. Prevent the full response (or part of the question) from being displayed to the user and provide a prompt.

[0069] ii. Attempt to correct or flag content (e.g., to identify potentially false information).

[0070] iii. Mark the content for manual review.

[0071] d. If the LSM determines that the complete response is compliant, it allows it to be finally displayed to the user (or confirms the integrity of the streaming output) As a preferred embodiment of the present invention, the method further comprises: Establish a multi-level service degradation strategy to prioritize the execution of core security rules when the system load is too high; Implement redundant deployment of LSM review services to avoid single points of failure; Set resource limits and timeout mechanisms to prevent malicious input from exhausting system resources.

[0072] In the above, “i” represents a high-risk event, “ii” represents a medium-risk event, and “iii” represents a low-risk event.

[0073] Reference Figure 2 , Figure 2The system architecture of the present invention is presented. The user inputs a request through the user interface module, which is submitted to the local small model (LSM) via the control and review middleware for pre-send review. If compliant, the request is sent to the external LLM interface module through the middleware. The response (streaming or complete) of the external LLM is received by the middleware and submitted to the LSM for real-time or overall review. The LSM makes judgments based on the rules and policy library. The middleware decides whether to release, interrupt or modify the response based on the LSM result, and returns the final result to the user interface. All key steps are recorded by the log and audit module. The fault tolerance and recovery module monitors the system operation status, and the review result feedback module collects user feedback and updates the rule library. The present invention also proposes an artificial intelligence dialogue compliance review system based on the local small model, including the following: User interface module, an interface for obtaining user input requests and receiving external LLM responses; a local LSM module, configured to examine the results of the associated content based on a first preset rule and policy, examine the results of the data segment based on a second preset rule and policy, and examine the results of the associated content based on a third preset rule and policy; The local LSM module is a lightweight language model deployed in the user's local environment (or trusted private cloud). It has certain natural language understanding and content analysis capabilities and is used to perform compliance checks. Due to its small model size and low computing resource requirements, LSM has the following significant advantages: Fast response speed: It can review the user input in real time without waiting for the user to complete the input; Low latency: Input review can be completed before the user submits the data; Efficiency: censorship at the output end will not significantly affect the overall efficiency of LLM output; Low resource usage: It can be run on ordinary servers or terminal devices without the need for high-performance computing resources; In addition, the LSM optimization design is as follows: Independent process deployment: LSM runs in an independent process, separate from the main application, reducing the impact of the review process on the main process. Model distillation technology: distilling specialized review capabilities from large models to improve the accuracy of LSM on specific tasks; Quantization and compression: Use model quantization technology to reduce memory usage and optimize inference performance; Dedicated review model clusters: Train or fine-tune different small models for different types of review tasks (such as sensitive word detection, format verification, and professional terminology review) to form a "review model cluster"; An external LLM interface module, used for calling an external LLM model, and the external LLM model is used for responding to the associated content in a streaming or complete response manner; The control and review middleware, located between the user interface module and the external LLM interface module, coordinates the review process of the local LSM module, manages information interaction with the external LLM, and performs blocking / release / modification operations (i.e., executes the relevant processes of the AI ​​dialogue compliance review method based on a local small model proposed in this invention). The middleware enhancement design is as follows: Adaptive buffer: Dynamically adjusts the buffer size for streaming review based on LLM output speed and LSM processing capacity; Priority queue: Implements a review task classification mechanism, giving priority to high-risk content; Parallel processing pipeline: supports processing multiple text segments simultaneously, improving throughput; Rules and policy library: stores compliance rules, sensitive word lists, data format requirements, professional terminology specifications, risk level definitions, etc. for use by LSM.

[0074] The log and audit module is used to record all interaction requests, review results, and processing actions.

[0075] Throughout the entire process, the log and audit module records the user's original request, the review results of each LSM stage (including the type and location of the detected problem), the middleware's processing actions (release, block, interrupt, modify), the response content (or fragment) of the external LLM, and the content finally presented to the user.

[0076] As a preferred embodiment of the present invention, the system further includes: Fault tolerance and recovery module, which is used to monitor the status of each component of the review system and implement fault detection, degradation strategy and automatic recovery mechanism; The review result feedback module collects user feedback on the review results, and users continuously update the local LSM model and rule base.

[0077] Strategy library enhanced design: Dynamic rule base: supports hot updates, and new rules can be applied without restarting the service Rule conflict resolver: automatically detects and resolves conflicts between rules and clarifies priorities Rule self-learning: Automatically extract and update rules from manual review feedback.

[0078] Specifically, when applying the instance scenario, Scenario 1: Weather forecasters use this system to assist in writing typhoon warning text messages; 1a. User Input: The forecaster enters the following command into the user interface (e.g., the internal forecast platform integration interface): "Please generate a typhoon red alert SMS message for the public based on the latest typhoon path forecast and the XX internal meeting minutes (Document ID: confidential_doc_001), emphasizing the landfall time and primary impact areas." 1b. LSM pre-send review: The control middleware submits the request to the LSM. The LSM reviews the user input based on the rules and policy library to check whether it contains: Sensitive words and confidential information that are explicitly prohibited from transmission (such as "internal meeting minutes" and "confidential_doc_001"); Inducing instructions that may cause external LLMs to produce non-compliant content; Potential prompt injection attack; 1c. LSM review result: LSM, through its rule base, identifies "Internal Meeting Minutes" and "confidential_doc_001" as sensitive information that should not be sent to external models. LSM returns a "non-compliant" result, indicating that sensitive content has been detected.

[0079] 1d. Decision-making and processing: Based on the preset strategy, the middleware performs the following operations: Directly prevent the request from being sent; A warning message is returned to the user: "The request contains sensitive information (internal meeting minutes) and cannot be sent to an external model for processing. Please remove the relevant content or use redacted information." Document the violation; 1e. Process End: Since the request is blocked, the process ends here.

[0080] Scenario 2: A user requests LLM to generate a weather science article, and inappropriate content appears during the output process. 1a. User input: "Write a popular science article about the impact of El Niño on Guangdong's summer climate, approximately 500 words." 1b. LSM pre-send review: The control middleware submits the request to the LSM. The LSM reviews the user input based on the rules and policy library to check whether it contains: Sensitive words and confidential information; Inductive instructions; Prompt injection attack; passed LSM review, the content does not contain sensitive information.

[0081] 1c. LSM review result: LSM returns a "compliant" result.

[0082] 1d. Decision and processing: Based on the preset policy, the middleware allows the request to pass.

[0083] 1e. Send and process: The request is sent to the external LLM. The LLM starts generating the article and returns it in a streaming manner.

[0084] 2a. External LLM processing: The external LLM starts processing the request.

[0085] 2b. Receive streaming output: The control middleware receives streaming output data segments from the external LLM.

[0086] 2c. LSM real-time streaming review: The middleware forwards the received data fragments to the LSM for immediate review. Based on the rules and policy library, the LSM performs real-time analysis of the streaming output content, checking: Whether sensitive words, confidential information, or inappropriate remarks appear; Whether there is any content that clearly conflicts with known facts or field knowledge; Whether it complies with predefined output format or style requirements; 2d. LSM Review Results: LSM detected expressions such as "no harvest, causing social unrest" in real time and, based on the rule base, identified them as inappropriate content that exaggerated the consequences of the disaster and could potentially cause panic.

[0087] 2e. Real-time decision-making and interruption: The LSM returns a "serious violation" signal. The control middleware immediately executes: The interrupt forwards subsequent streaming output to the user interface module; Display a preset prompt message to the user: "Content generation has been aborted. Potentially inappropriate content has been detected." Record details of the violation; 2eiii. Logging: Logging and audit module records: User's original request; LLM has generated some of the content; Problems detected by LSM; Interrupt operation details; Scenario 3: The interpretation content in the post-processing stage of LLM generation contains incorrect terminology; 1a. User input: "Interpret the weather forecast for this afternoon, focusing on the development of convective clouds." 1b. LSM pre-send review: The control middleware submits the request to the LSM. The LSM reviews the user input based on the rules and policy library to check whether it contains: Sensitive words and confidential information; Inductive instructions; Prompt injection attack; LSM review passed.

[0088] 1c. LSM review result: LSM returns a "compliant" result.

[0089] 1d. Decision and processing: Based on the preset policy, the middleware allows the request to pass.

[0090] 1e. Send and process: The request is sent to the external LLM. The LLM processes it and returns a complete response (assuming it is not streaming, or if it is streaming, the fragments have been approved).

[0091] 3a. LSM Overall Review: Once the external LLM has completed all content generation, the control middleware submits the complete response content to the LSM. The LSM performs a more comprehensive review, including: Evaluate the overall content for logical consistency and factual accuracy; Comparison with historical interactions or background knowledge; Conduct more complex compliance checks, such as compliance with meteorological terminology standards; 3b. LSM Review Results: LSM compared meteorological terminology and standards and found that: "Severe thunderstorm cloud" is usually expressed as "severe convective cloud cluster" or with specific description of cloud characteristics; The context should be used to clarify whether "gusts" refer to thunderstorm gales or other types of gusts; LSM judged that there was an issue with the non-standard use of terminology.

[0092] 3c. Processing: Based on the policy, the middleware performs the following actions: Mark the problem; Prompt user: "Potentially non-standard meteorological terminology detected: 'severe thunderstorm cloud', recommended to be changed to 'severe convective cloud cluster'. The source of 'gusts' needs to be clarified." Display the marked content to the user; 3d. Output and record: The user sees the response content marked with a suggested edit; The log and audit module records all processes, including: User's original request; LLM complete response; Problems detected by LSM; Processing results.

[0093] In addition, the functional modules in various embodiments of the present invention may be integrated into a single processing module, or each module may exist physically separately, or two or more modules may be integrated into a single module. The aforementioned integrated modules may be implemented in the form of hardware or software functional modules.

[0094] If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the process in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or system that can carry the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal and software distribution medium, etc.

[0095] Although the present invention has been described in considerable detail and with particularity with respect to several described embodiments, it is not intended to be limited to any of these details or embodiments or any particular embodiment, but rather should be construed as providing a broad possible interpretation of these claims in view of the prior art by reference to the appended claims, thereby effectively encompassing the intended scope of the invention. In addition, the invention has been described above in terms of embodiments foreseen by the inventors for the purpose of providing a useful description, and those insubstantial modifications of the invention that are not currently foreseen may still represent equivalent modifications of the invention.

[0096] The above description is merely a preferred embodiment of the present invention. The present invention is not limited to the above-described embodiments. As long as the technical effects of the present invention are achieved by the same means, they shall fall within the scope of protection of the present invention. Within the scope of protection of the present invention, various modifications and variations of the technical solutions and / or implementation methods may be made.

Claims

1. An artificial intelligence dialogue compliance review method based on a local small model, characterized by: These include: Get user input request and its associated content; Send the associated content to the local LSM, obtain the local LSM's review result of the associated content based on the preset first rule and policy, determine whether there is a pre-sending violation event, and if so, handle it accordingly according to the risk level of the pre-sending violation event; if not, send the associated content to the external LLM; The external LLM responds to the associated content via streaming or complete response; Streaming mode: Obtain the generated content, i.e., multiple data segments, returned by the external LLM in a streaming manner for the associated content, send each data segment to the local LSM, obtain the local LSM's review results of the data segment based on the preset second rule and policy, determine whether there is a data segment violation event, and if so, perform corresponding processing according to the risk level of the data segment violation event; if not, display the data segment content; Complete response mode: directly obtain the content display of the related content from the external LLM; The content display of all data fragments in the streaming mode or the content display in the complete response mode is recorded as the whole content and sent to the local LSM. The local LSM obtains the review results of the related content based on the preset third rules and policies, and determines whether there is an overall content violation event. If so, it is handled accordingly according to the risk level of the overall content violation event. If not, the whole content is displayed to the user.

2. The method for compliance review of artificial intelligence dialogue based on a local small model according to claim 1 is characterized in that: The method further comprises, After completing a dialogue compliance review, the user's related content and the review results of each LSM stage will be recorded in the log. The review results include the type and location of the detected problem, and related processing actions. The related processing actions include release, block, interruption, modification, the response content of the external LLM, and the content finally presented to the user.

3. The method for compliance review of artificial intelligence dialogue based on a local small model according to claim 1 is characterized in that: The method further includes providing a channel for users to raise objections to the review results to obtain the user's objection request, and when the user's objection request is obtained, processing the user's objection request through manual review.

4. The method for compliance review of artificial intelligence dialogue based on a local small model according to claim 1 is characterized in that: The method further comprises, When the local LSM determines that there is a high-risk event among pre-sending violation events, data segment violation events, or overall content violation events, the high-risk event is cross-validated through multiple small models with different architectures to reduce the misjudgment rate.

5. The method for compliance review of artificial intelligence dialogue based on a local small model according to claim 1 is characterized in that: Specifically, the preset first rules and strategies include: High-risk events, where the transmission of sensitive words and confidential information is explicitly prohibited; Medium-risk events may cause external LLM to generate non-compliant content, including misleading instructions or high-risk question patterns, potential prompt injection attacks, and personal privacy data. Low-risk events include input content that is irrelevant to the work content, and duplicate or redundant request content; Corresponding decision-making and processing, For high-risk events, the request is directly blocked and a warning message is returned to the user. For medium-risk events, LSM desensitizes and modifies the request content before submitting it to the user to decide whether to send it. For low-risk events, only risk logs are recorded, prompts are popped up, and the event is sent to the backend.

6. The method for compliance review of artificial intelligence dialogue based on a local small model according to claim 1 is characterized in that: Specifically, the preset second rules and strategies include: High-risk events: whether sensitive words, confidential information, or inappropriate remarks appear; For medium-risk events, whether there is content that clearly conflicts with known facts or domain knowledge; Low-risk events: whether they comply with predefined output format or style requirements; Corresponding decision-making and processing, High-risk events interrupt the forwarding of subsequent streaming output to the user interface module; For medium-risk events, a preset prompt message is displayed to the user; Low-risk events, record the details of the violation.

7. The method for compliance review of artificial intelligence dialogue based on a local small model according to claim 1 is characterized in that: Specifically, the preset third rules and strategies include: For high-risk events, the logical consistency and factual accuracy of the overall content will be evaluated, and if obvious errors, false information, or seriously misleading content are found; For medium-risk events, when compared with historical interactions or background knowledge, it is found that some information is inaccurate, the expression is not rigorous enough, or there is content that needs additional explanation. Low-risk events, details such as formatting standards, reference integrity, and the use of professional terminology; Corresponding decision-making and processing, High-risk events, Prevent the full response from being displayed to the user, generate an error prompt and suggest the user to ask the question again; Medium-risk events, Correct or supplement the content, add necessary warning signs, and allow users to view suggested changes; Low-risk events, Mark content for manual review, allowing users to view and edit it.

8. The method for compliance review of artificial intelligence dialogue based on a local small model according to claim 1 is characterized in that: The method further comprises, Establish a multi-level service degradation strategy to prioritize the execution of core security rules when the system load is too high; Implement redundant deployment of LSM review services to avoid single points of failure; Set resource limits and timeout mechanisms to prevent malicious input from exhausting system resources.

9. An artificial intelligence dialogue compliance review system based on a local small model, characterized by: These include: User interface module, an interface for obtaining user input requests and their associated content and receiving external LLM responses; a local LSM module, configured to examine the results of the associated content based on a first preset rule and policy, examine the results of the data fragment based on a second preset rule and policy, and examine the results of the associated content based on a third preset rule and policy; An external LLM interface module, used for calling an external LLM model, and the external LLM model is used for responding to the associated content in a streaming or complete response manner; The control and review middleware is set between the user interface module and the external LLM interface module to coordinate the review process of the local LSM module, manage the information interaction with the external LLM, and perform blocking / release / modification operations; The log and audit module is used to record all interaction requests, review results, and processing actions.

10. The artificial intelligence dialogue compliance review system based on a local small model according to claim 9 is characterized in that: The system further includes, Fault tolerance and recovery module, which is used to monitor the status of each component of the review system and implement fault detection, degradation strategy and automatic recovery mechanism; The review result feedback module collects user feedback on the review results, and users continuously update the local LSM model and rule base.

Citation Information

Patent Citations

  • Large language model data interaction compliance detection method and device, equipment and medium

    CN118805166A

  • End-to-end hybrid expert model training method and device and electronic equipment

    CN119884893A

  • Modified silicone urethane waterproofing paint composition and constructing method for waterproofing bridge surface using the same

    KR102501924B1

  • Guardrail machine learning model for automated software

    US20240354379A1

  • Intelligent generation of personalized CQL artifacts

    US20250046407A1

Cited By

  • Unified streaming processing method, system and device for multi-mode AI interactive content, medium and program product

    CN121705057A