Government affair large model application security protection method and system based on rule and semantic double engines

By constructing a security protection method for the government affairs big data model with dual engines of rules and semantics, the problem of incomplete protection by a single engine in existing technologies is solved, and full-process, multi-layer security protection for the government affairs big data model is achieved, ensuring the security and compliance of government data.

CN121435236APending Publication Date: 2026-01-30ANHUI LONSUN INFORMATION TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202511606939.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-05
Publication Date
2026-01-30

AI Technical Summary

Technical Problem

Existing security protection methods for government big data models suffer from incomplete protection by a single engine, vulnerabilities in risk identification, difficulty in identifying hidden risks that appear compliant but are semantically non-compliant, and a lack of a collaborative prevention and control mechanism throughout the entire process.

Method used

A dual-engine protection approach based on rules and semantics is adopted. A sub-library of rules for sensitive information, access control, and format compliance is constructed. A semantic engine is built by combining training corpus specifically for the government sector. The rule engine quickly filters out explicit risks, while the semantic engine deeply verifies implicit risks, achieving multi-layered security protection throughout the entire process.

Benefits of technology

It achieves full-process, multi-layered security protection for input requests and output responses of the government affairs big data model, ensuring the security of government data and service compliance, avoiding misjudgment of compliant requests, and improving the efficiency and rigor of protection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121435236A_ABST
    Figure CN121435236A_ABST
Patent Text Reader

Abstract

The invention discloses a government affair large model application security protection method and system based on rule and semantic double engines, and relates to the technical field of model security protection. According to the method, through a double-engine cooperation mechanism of rule engine pre-filtering and semantic engine deep verification, explicit risks such as sensitive information, unauthorized access and format violation are rapidly screened out through the rule engine, the protection efficiency is improved, the authenticity of government affair entities, user intention compliance and hidden semantic risks are accurately recognized through the semantic engine, and the safety of the government affair entities is improved. A protection blind area of a rule engine is made up, full-process and multi-level safety protection of government affair large model input requests and output responses is achieved, government affair data safety and government affair service authority compliance are guaranteed, meanwhile, compliance requests are prevented from being misjudged, protection preciseness and user experience are considered, government affair large model safety is promoted, and the government affair large model safety is improved. The problems that in existing government affair large model safety protection, single engine protection is not comprehensive, and vulnerabilities exist in risk identification are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of model security protection technology, specifically to a security protection method and system for government large-scale model applications based on a dual engine of rules and semantics. Background Technology

[0002] Current security protection methods for large-scale government service models primarily rely on a combination of traditional rule-driven approaches and basic semantic detection. They depend heavily on pre-defined rule bases to intercept explicit risks, such as screening for sensitive political terms and privacy fields like ID numbers through keyword filtering and regular expression matching. They also rely on static role-based access control (RBAC) models to manage access permissions for government resources. Some protection schemes incorporate basic natural language processing techniques to assist in identifying formatting errors or simple semantic deviations. At the data level, conventional anonymization methods are often used to handle privacy information in training data, but there is a lack of systematic prevention and control against the risks of poisoning training data and leakage from multi-source data associations. During the operational phase, the focus of protection is mainly on post-event review of input and output content, with insufficient security assessment of pre-event stages such as model training and deployment.

[0003] The core reason why these types of protection methods have vulnerabilities in risk identification lies in the insufficient adaptability of their technical architecture to the needs of government service scenarios: Rule-driven protection has inherent rigid blind spots. It cannot identify hidden risks that appear compliant but are semantically non-compliant, such as probing for classified information under the guise of policy consultation or using English prompts to bypass Chinese sensitive word review. It also has difficulty dealing with variant forms of sensitive information. Static permission models cannot adapt to the risk of information leakage in dynamic dialogues and have difficulty managing the evolution of permissions in different interactive contexts. Basic semantic detection is mostly based on general large model frameworks and has not been specifically optimized for government entities, such as fictitious institutions, code names of classified projects, and policy logic. It is prone to generating incorrect information or missing semantic risks due to model illusions, and lacks effective detection capabilities for new types of attacks such as data poisoning.

[0004] In addition, the protection system often operates in a fragmented manner at each stage of the model lifecycle, lacking a whole-process collaborative prevention and control mechanism, resulting in a detection gap between potential risks in pre-training and risks in post-interaction. Summary of the Invention

[0005] To address the shortcomings of existing technologies, this invention provides a method and system for security protection of government affairs large-scale models based on a dual-engine approach of rules and semantics, which solves the problems of incomplete protection by a single engine and vulnerabilities in risk identification in existing government affairs large-scale model security protection.

[0006] To achieve the above objectives, the present invention provides the following technical solution: a security protection method for government affairs large-scale model applications based on a dual-engine approach of rules and semantics, comprising the following steps: Build a rules engine and a semantic engine; Receive input requests initiated by users and preprocess the input requests; The rule engine performs compliance checks on the preprocessed input requests to determine whether the rules are compliant. If the rules are compliant, the semantic engine will perform semantic compliance checks on the preprocessed input request to determine whether the semantics are compliant. If semantically compliant, output the response result.

[0007] Furthermore, the process of building a rules engine includes building a sub-library of sensitive information rules, an access control rules sub-library, and a format compliance rules sub-library.

[0008] Furthermore, the process of constructing the sensitive information rule sub-base is as follows: Collect samples of sensitive information and label them by type, including politically sensitive, privacy sensitive, policy sensitive, and entity sensitive; We employ a string exact matching algorithm to adapt to politically sensitive samples; a fuzzy matching algorithm based on edit distance to adapt to entity-sensitive samples; and a regular expression algorithm to adapt to privacy-sensitive and policy-sensitive samples. The labeled sensitive information samples, the adapted matching algorithms, and the preset matching rules are associated to form a mapping table, which forms a sensitive information rule sub-library.

[0009] Furthermore, the process of constructing the access control rule sub-library is as follows: Based on the affiliation and functions of government departments, a three-dimensional role classification system is established, and each role is assigned a unique role identifier; The associated resources are categorized by type, and the corresponding operation permissions for each type of resource are determined to form a mapping table between resources and operation permissions. Using role identifiers as indexes, a mapping rule base is established by associating resources with operation permissions, forming an access control rule sub-base.

[0010] Furthermore, the process of constructing the format compliance rule sub-library is as follows: Establish reference standards for format compliance, including rules for input text length, rules for disabling special characters, and rules for formatting government terminology, forming a format compliance rule sub-library, specifically: The maximum text length is set to 64k characters, and the minimum is 1 character. If the input text length exceeds this range, it will be judged as a length violation. Create a list of prohibited characters, and set a rule that if an input request contains any character from the list, it will be considered a character violation; If the standardization matching degree of government terminology in the input request is lower than a preset threshold, it will be judged as a terminology format violation.

[0011] Furthermore, the process of building a semantic engine is as follows: Collect training corpora specifically for the government affairs sector and preprocess them; The preprocessed training corpus was annotated, and the annotation content included government entity tags, user intent tags, and semantic risk tags. A semantic engine is built based on a large language model as the foundation. The preprocessed unlabeled training corpus is input into the semantic engine for initial optimization through unsupervised learning. The labeled training corpus was divided into training and validation sets in a 7:3 ratio and input into the preliminarily optimized semantic engine. The gradient descent algorithm was used to adjust the model parameters. The validation set is input into the trained semantic engine. If the performance indicators of the semantic engine do not reach the threshold, the annotated corpus is supplemented and the fine-tuning process is repeated until the indicators reach the threshold.

[0012] Furthermore, the process of performing compliance checks on the preprocessed input requests based on the rule engine to determine whether the rules are compliant is as follows: The sensitive information rules sub-library is invoked to perform layered detection on the preprocessed input request to determine whether the sensitive information is compliant. If the sensitive information is compliant, the access control rules sub-library is invoked to determine whether the access control is compliant. If access control is compliant, the format compliance rule sub-library is invoked to determine whether the access format is compliant. If the access format is compliant, then the rules engine rules are compliant.

[0013] Furthermore, the process of performing semantic compliance checks on the preprocessed input request based on the semantic engine to determine whether the semantics are compliant is as follows: Receive preprocessed input requests; A named entity recognition algorithm is used to extract government entities from the input request text; The extracted government entities are compared with the government entity risk database built into the semantic engine; If the extracted government entity exists in the list of fictitious government entities, or belongs to the list of classified government entities and the requesting user does not have classified access rights, it is judged as a semantic violation; if the entities are all real, non-classified and match the request context, it is judged as entity compliance. After determining that the entity is compliant, the user intent of the input request is classified based on the TextCNN algorithm, and the intent is divided into four categories: policy consultation, service guide inquiry, government complaint and suggestion, and non-government service. Verify whether the categorized intent falls within the preset service scope of the government affairs big data model. If it does not, the intent is deemed to be in violation; if it does, the intent is deemed to be compliant. After determining that the text is semantically compliant, the SimCSE algorithm is used to calculate the semantic similarity between the input request text and the samples in the semantic engine's built-in semantic risk sample library. If the semantic similarity is ≥85% or there is a semantic risk marker, it is judged as a semantic violation; if the semantic similarity is <85% and there is no risk marker, it is judged as semantic compliance.

[0014] Furthermore, the response results include government answer information, links to the original policy documents, online access points for handling service items, and download links for relevant service guides.

[0015] A security protection system for government affairs large-scale model applications based on rule and semantic dual engines, including an engine building module for building a rule engine and a semantic engine; The request processing module is used to receive input requests initiated by users and preprocess the input requests; The rule compliance detection module is used to perform compliance checks on the preprocessed input requests based on the rule engine to determine whether the rules are compliant. The semantic compliance detection module is used to perform semantic compliance detection on the preprocessed input request based on the semantic engine if the rules are compliant, in order to determine whether the semantics are compliant. The response output module is used to output the response results when semantic compliance is achieved.

[0016] The present invention has the following beneficial effects: This security protection method for government affairs big data models, based on a dual-engine approach of rules and semantics, utilizes a collaborative mechanism of pre-filtering by the rules engine and deep verification by the semantic engine. The rules engine quickly filters out explicit risks such as sensitive information, unauthorized access, and format violations, improving protection efficiency. Meanwhile, the semantic engine accurately identifies the authenticity of government entities, the compliance of user intent, and implicit semantic risks, compensating for the blind spots of the rules engine. This achieves full-process, multi-layered security protection for the input requests and output responses of the government affairs big data model, ensuring the security of government data and the authoritative compliance of government services. It also avoids misjudging compliant requests, balancing rigorous protection with user experience. This helps government affairs big data models securely and reliably serve government-citizen interaction scenarios, addressing the problems of incomplete protection and vulnerability in risk identification inherent in existing government affairs big data model security protection methods that rely on a single engine. Attached Figure Description

[0017] Figure 1 This is a flowchart of the security protection method for government affairs big data model applications based on rule and semantic dual engines according to the present invention.

[0018] Figure 2 This is a schematic diagram showing the module connection of the government affairs big data application security protection system based on rule and semantic dual engines of the present invention. Detailed Implementation

[0019] Please see Figure 1 This invention provides a technical solution: a security protection method for government affairs large-scale model applications based on rule and semantic dual engines, including the following steps: constructing a rule engine and a semantic engine.

[0020] The process of building a rules engine includes building a sub-library of sensitive information rules, an access control rules sub-library, and a format compliance rules sub-library.

[0021] The process of constructing a sub-library of sensitive information rules is as follows: In accordance with national regulations on government confidentiality management, the Personal Information Protection Law, and a database of cases of violations in the government sector, sensitive information samples were collected and categorized, including politically sensitive, privacy-sensitive, policy-sensitive, and entity-sensitive information. The sample sources included historical sensitive request data from government systems, a list of unpublished policy documents, and a directory of government privacy fields (including ID card numbers, social security accounts, government service passwords, and codes for classified projects). The collected samples were categorized as follows: politically sensitive words were categorized as politically sensitive, personal privacy fields as privacy-sensitive, unpublished policy document identifiers as policy-sensitive, and classified government entities (unpublished organization names and classified project codes) as entity-sensitive.

[0022] Based on national regulations on government confidentiality management, the Personal Information Protection Law, and a database of cases of violations in the government sector, the system ensures the legality and compliance of sample collection, avoiding protection failure due to non-compliance of sample sources or classifications with regulatory requirements. By covering multiple sample sources, including historical sensitive request data from government systems, lists of unpublished policy documents, and directories of government privacy fields, the system comprehensively encompasses political, privacy, policy, and entity-related sensitive information, avoiding omissions of key sensitive types. Precise labeling by sensitivity type (e.g., labeling politically sensitive words as politically sensitive and unpublished organization names as entity-sensitive) lays a classification foundation for accurate adaptation of subsequent matching algorithms and rule association, preventing detection errors caused by confusion of different types of sensitive information.

[0023] Matching Algorithm Selection and Adaptation: Corresponding matching algorithms are configured for different types of sensitive information samples. Specifically: a string exact matching algorithm is used to adapt to political sensitive samples to identify complete politically sensitive words; a fuzzy matching algorithm based on edit distance is used to adapt to entity sensitive samples to identify entities that are similar to classified government entities (such as misspelled or abbreviated names of unpublished organizations); and a regular expression algorithm is used to adapt to privacy and policy sensitive samples. Specifically, a format matching regular expression is constructed for structured privacy fields such as ID card numbers and social security accounts (such as the \d{17}[\dXx] format of an 18-digit ID card number), and a feature matching regular expression is constructed for identifiers of unpublished policy documents (such as internal draft for comments - XX〔202X〕XX).

[0024] Dedicated algorithms are configured for the feature differences of different sensitive types to achieve precise type-algorithm adaptation. The string exact matching algorithm can ensure the complete and error-free identification of political sensitive words and avoid misjudgment caused by fragment matching; the fuzzy matching algorithm based on edit distance can effectively identify typos and abbreviations of classified government entities (such as XX City Undisclosed Project Group mistakenly written as XX City Undisclosed Item Group), making up for the blind spot of exact matching in the identification of variant sensitive information; the regular expression algorithm can build dedicated matching logic for sensitive information with fixed format / features such as ID card numbers and undisclosed policy document identifiers (such as the \d{17}[\dXx] format of 18-digit ID card numbers), improve the identification efficiency and accuracy of structured and feature-based sensitive information, and avoid the problem of inaccurate identification by general algorithms.

[0025] The labeled sensitive information samples, the adapted matching algorithms, and the preset matching rules are associated to form a mapping table, forming a sensitive information rule sub-library. Among them: the full-word matching rule is associated with political sensitive samples and the string precise matching algorithm, and is set to trigger the rule only when the complete sensitive word appears in the input request; the fragment matching rule is associated with entity sensitive samples and the fuzzy matching algorithm, and is set to trigger the rule when the fragment in the input request has an edit distance ≤2 from the classified entity; the semantic association matching trigger rule is associated with policy sensitive and privacy sensitive samples and the regular expression algorithm, and is set to trigger the rule when the sensitive fragment in the input request meets the regular expression format and the fragment is associated with the political context (such as the expression "not public" or "classified").

[0026] By establishing a mapping table, the corresponding logic of sensitive type, matching algorithm, and triggering rule is clarified, enabling the rule engine to call the corresponding algorithm and rule according to the type during detection, thereby improving detection efficiency. The full-word matching rule is set to trigger only when the entire political sensitive word appears, avoiding false blocking caused by sensitive word fragments (such as "politics" appearing alone). The fragment matching rule is set to trigger when the edit distance is ≤2, which ensures the identification of similar entities while reducing excessive blocking through threshold control. The semantic association matching triggering rule requires sensitive fragments + political sensitive context to trigger, avoiding the misjudgment of isolated compliant format fragments (such as a simple 18-digit number string) as privacy sensitive information, balancing the rigor of protection with the pass rate of normal user requests. At the same time, the structured sub-library architecture also facilitates subsequent iterative updates based on the addition of new sensitive types and algorithm optimization needs.

[0027] The process of building the access control rules sub-library is as follows: Based on the affiliation of government departments (such as finance departments, civil affairs departments, and government service centers), job levels (such as staff members, deputy section chiefs, section chiefs, division chiefs and above), and work functions (such as business approval, policy consultation, system operation and maintenance, and the general public), a three-dimensional role classification system is established, and each role is assigned a unique role identifier (such as civil affairs - staff member - consultation, finance - division chief - approval, and the public - none - inquiry).

[0028] A role classification system is constructed using three dimensions: affiliation to government departments, job level, and job function. This system accurately reflects the strong correlation between role permissions and departmental attributes, job level, and job content in government scenarios, avoiding the ambiguity of role permissions caused by single-dimensional classification (such as only by department or job level). Each role is assigned a unique structured identifier of department-job level-function (such as civil affairs-staff member-consultant), which can quickly locate the core attributes of the role and ensure unambiguous matching of permissions in the future. At the same time, it lays a unified identifier foundation for the collaborative reuse of role permissions between different government systems and improves the consistency of cross-module permission management.

[0029] The associated resources are categorized by type. The government knowledge base includes a national policy database (accessible only to government personnel at the division level and above), a provincial policy database (accessible only to government personnel at the section level and above), a municipal / county-level policy database (accessible only to government personnel at the staff level and above), and a public service item database (accessible to all roles). The large model's functional modules include a policy interpretation module (accessible to government personnel and the public), a service guidance module (accessible only to government personnel and the public), and a data export module (accessible only to system maintenance personnel and government personnel at the division level and above). The corresponding operation permissions (query, interaction, data export) for each type of resource are determined, forming a correspondence table between resources and operation permissions.

[0030] Resources are categorized by government knowledge base partitions and large model functional modules. This approach aligns with the hierarchical confidentiality characteristics of government resources (e.g., national-level policy databases have a higher confidentiality level than municipal / county-level databases) and covers the core service functions of the large model, achieving structured resource management. Clearly defined query, interaction, and data export permissions are applied to different resources to avoid overgeneralization of permissions (e.g., granting only query permissions to ordinary roles while restricting high-risk permissions such as data export), effectively preventing the risk of government data leakage due to unclear permission boundaries. A resource-operation permission mapping table is created, making the relationship between resources and permissions visible and providing a clear reference for subsequent role-permission matching, reducing permission configuration errors.

[0031] Using role identifiers as indexes, a mapping table is established to associate resources with operational permissions, forming a mapping rule base and an access control rule sub-base. Specifically: For the Civil Affairs - Staff Member - Consultant role, access to the municipal / county-level policy database and the public service item database is granted, along with query and interaction permissions for the policy interpretation and service guidance modules, but no data export permissions are allowed; For the Finance - Department-Level - Approval role, access to the national, provincial, and municipal / county-level policy databases and the public service item database is granted, along with query and interaction permissions for all functional modules, and export permissions for the data export module; For the Public - None - Query role, access to the public service item database is limited to query permissions for the policy interpretation and service guidance modules.

[0032] By using role identifiers as indexes to associate resource-operation permission mapping tables, a precise mapping relationship between roles, permissions, and resources is constructed, implementing the principle of least privilege. For example, roles such as Civil Affairs, Clerk, and Consultant are only granted access to and query / interact with municipal / county-level policy databases that are necessary for their work, and are not granted unnecessary permissions such as data export, reducing the risk of unauthorized access. Differentiated permissions are configured for different roles (e.g., the public can only access public resources, while roles at the division level and above can access higher-level policy databases), which not only meets the needs of hierarchical office work for government personnel, but also ensures that classified government resources are only open to authorized roles. At the same time, the structured mapping rule library facilitates the rapid configuration of permissions when adding new roles (e.g., adding Tax, Section Chief, and Approval roles), improving the efficiency of permission management.

[0033] By simulating resource access requests from different roles, the system verifies whether the mapping rules accurately trigger permission checks (e.g., when a public role requests access to a national policy database, the rule determines that the user has no permission). Permission verification logic is embedded in the rule sub-library. When a user initiates an access request, the system first extracts the user's role identifier and then matches it against the mapping rule library. If the role and resource-operation permissions do not match, the system determines that the permission is violated, ensuring that only authorized roles can access the corresponding resources.

[0034] By simulating access requests from different roles (such as public requests to access a national policy database) to verify the accuracy of rules, permission configuration vulnerabilities (such as mismatches between roles and resources) can be detected in advance, preventing unauthorized access issues after deployment and ensuring the effectiveness of the rule base. An automated verification logic is embedded in the sub-database to extract role identifiers, match them with the rule base, and determine permission compliance. This allows for permission determination without manual intervention, improving the efficiency of processing requests in the large-scale government affairs model. Clear criteria are established for determining violations based on mismatches between roles and resources / operation permissions, forming a rigid constraint on permission control. This ensures that only authorized roles can access corresponding resources, technically guaranteeing the security and compliance of government resource access.

[0035] The process of building the format compliance rule sub-library is as follows: Establish reference standards for format compliance, including rules for input text length, rules for disabling special characters, and rules for formatting government terminology, forming a format compliance rule sub-library, specifically: Format compliance rule formulation: a) Input text length rules: For government affairs Q&A scenarios, the upper limit of text length is set to 64k characters (to adapt to the needs of consulting long text policy documents), and the lower limit is 1 character (to avoid empty requests). If the input text length exceeds this range, it will be judged as a length violation. b) Special character disabling rules: Review the input risk characters for the government affairs big data model, including SQL injection characters (such as SELECT, INSERT, DELETE) and script injection characters (such as...). <script>,< / script> ), garbled characters (such as unrecognized Unicode special characters), create a list of prohibited characters, and set it so that if the input request contains any character in the list, it is judged as a character violation; c) Rules for the format of government terminology: Clarify the standardized expressions of government terminology (e.g., government service center cannot be expressed as government service hall, government service center, social insurance cannot be expressed as social insurance), establish a terminology format verification database, and set a rule that if the standardization matching degree of government terminology in the input request is lower than a preset threshold, it will be judged as a terminology format violation.

[0036] To ensure that the formatting rules comply with the legal requirements and industry standards for data processing in the government sector, compliance risks arising from self-defined rules are avoided. Furthermore, rules are developed based on the actual needs of long-text policy consultations and short-text service inquiries in government Q&A scenarios, making the rules more tailored to user scenarios. Specifically, the input text length rule sets a 64k character limit to meet users' needs for consulting long policy documents, while a 1-character limit filters empty requests to reduce unnecessary system load. The special character disabling rules specifically address risky characters such as SQL injection and script injection, directly preventing malicious character attacks on the government big data model system (such as data tampering and information leakage), ensuring system security. Clear and standardized expressions avoid misunderstandings of user requests by the big data model due to non-standard terminology (e.g., "government hall" referring to "government service center"), improving the accuracy of government Q&A and the professionalism of government services.

[0037] Format violation judgment threshold settings: For the special character prohibition rule, the number of prohibited characters appearing ≥1 in a single input is set as a violation; for the government terminology format rule, the number of non-standard terms in a single input is set ≥2 as a violation. The rules for disabling special characters stipulate that a violation occurs if the character appears more than once, adopting a zero-tolerance policy. This approach can prevent risky characters from entering the system to the greatest extent possible, blocking security risks such as injection attacks at the source and ensuring the strictness of the rules. The rules for formatting government terminology stipulate that a violation occurs if the number of non-standard terms is more than two. This approach balances the rigor of the rules with the flexibility of user use. It avoids judging violations based on occasional typos in terminology (such as one non-standard expression), reducing false blocking and improving user experience. At the same time, it can control requests that frequently use non-standard terms, ensuring the standardization of government text communication.

[0038] Format compliance rule optimization: Based on feedback from actual applications of the government affairs big data model (such as users being misjudged due to reasonably long texts or the failure to recognize standardized terms), rule parameters are adjusted regularly (such as optimizing the upper limit of text length based on the average length of policy documents and adding new government affairs terms to the verification library) to ensure that the rules not only meet compliance requirements but also adapt to the actual usage scenarios of government affairs users.

[0039] Adjusting rule parameters based on feedback from real-world applications of the government affairs big data model (such as optimizing the upper limit of text length based on the average length of new policy documents and adding new government affairs terms to the verification library) can prevent rules from becoming rigid. This not only solves practical problems such as users being misjudged due to reasonably long texts and new standardized terms not being recognized, but also ensures that rules continuously adapt to changes in government affairs scenarios (such as new policies and new service items). Regular optimization ensures that rules always balance compliance requirements with actual user needs, avoiding the failure of protection or the impact on the efficiency of government services due to rule lag, and guaranteeing the long-term usability and effectiveness of the format compliance rule sub-library.

[0040] The process of building a semantic engine is as follows: Collect training corpora specifically for the government affairs sector and preprocess them; the sources of the training corpora include at least four levels of policy documents (including implementation rules and policy interpretation texts) at the national / provincial / municipal / county levels, government service guide data (including acceptance conditions, application materials, and processing procedures), public messages and replies from the 12345 government service hotline, and historical interaction violation request samples from the government affairs big data model.

[0041] Hash algorithms are used to desensitize personal privacy fields (ID number, social security account, contact number) in the corpus; redundant spaces, invalid characters and garbled text are removed through text cleaning; and pronoun resolution technology is used to clarify the specific government entities (such as "XX City Science and Technology Enterprise Cultivation and Recognition Management Measures" and "XX City Government Service Center") that pronouns (such as "this policy" and "this institution") in the corpus refer to.

[0042] The preprocessed training corpus is labeled with tags including government entity tags (institution name, place name, policy file name, leader's name), user intent tags (policy consultation intent, service guide query intent, non-government service intent), and semantic risk tags (implicit sensitive appeal tags, policy misinterpretation appeal tags, compliance appeal tags).

[0043] The corpus was collected from policy documents at the national, provincial, municipal, and county levels, government service guides, 12345 hotline data, and historical samples of illegal requests. This corpus covers the government policy system, service scenarios, user interaction examples, and risk cases, ensuring it closely matches actual government application scenarios. This injects professional knowledge and risk identification criteria into the model, avoiding insufficient government adaptability issues caused by general corpora. In the preprocessing stage, a hash algorithm was used to de-identify privacy fields (ID numbers, social security accounts, etc.), complying with the Personal Information Protection Law and government data confidentiality requirements to prevent privacy leaks. Text cleaning removed redundant characters and garbled text, improving the quality of the corpus data and reducing the impact of interfering information on model training. Referential resolution clarified the government entities pointed to by pronouns (such as the specific document corresponding to the policy), solving the problem of ambiguous entity referencing in government texts and helping the model accurately understand the logic of the government context, laying the foundation for subsequent accurate entity and semantic identification.

[0044] The corpus is labeled with government entity tags (organization names, policy file names, etc.), user intent tags (policy consultation, non-government services, etc.), and semantic risk tags (implicit sensitive requests, policy misinterpretation requests, etc.). This provides the model with a supervised learning feature-tag correspondence. Entity tags enable the model to accurately extract key government information and avoid misclassifying non-government entities as government entities. Intent tags help the model clarify the core demands of user requests, providing a basis for subsequent judgments on whether the intent falls within the scope of government services. Semantic risk tags specifically label implicit violation characteristics unique to government scenarios, enabling the model to learn semantic patterns of superficial compliance and substantive violation, filling the gap in general models for identifying semantic risks in government affairs.

[0045] Based on the Large Language Model (LLM) framework, and incorporating functional modules specific to government affairs scenarios, a semantic engine is constructed, including: The government entity recognition module is used to integrate named entity recognition algorithms and optimize the recognition model parameters for entities unique to the government sector (such as government agency names, policy document numbers, and classified project codes) to enable them to accurately extract and classify government entities. Government Intent Classification Module: A classification model is built based on the TextCNN algorithm. The model uses labeled user intent tags as training data to classify the intent of input requests into four categories: policy consultation, service guide inquiry, government complaint and suggestion, and non-government service. Implicit Semantic Risk Judgment Module: Based on the SimCSE algorithm, a semantic similarity calculation model is constructed. Using labeled semantic risk tag corpus as training data, the model can identify requests that are compliant on the surface but violate semantic rules, including requests containing implicit sensitive requests (such as probing for classified information under the guise of consulting on policies) and requests that distort policy (such as deliberately distorting the meaning of policy clauses).

[0046] Based on a Large Language Model (LLM) framework, the model possesses strong general semantic understanding capabilities. It integrates government-specific functional modules, combining general capabilities with government-specific adaptation. The government entity recognition module optimizes parameters for government-specific entities (such as classified project codes and policy document numbers), achieving greater accuracy compared to general entity recognition models and avoiding misclassification of the XX Municipal Government Service Center as an ordinary institution. The TextCNN-based intent classification module adapts to the characteristics of government request texts, efficiently and accurately segmenting user intent to meet the speed and accuracy requirements of intent judgment in government scenarios. The SimCSE-based implicit semantic risk judgment module identifies implicit violations (such as probing for classified information under the guise of policy consultation) through semantic similarity calculation, compensating for the rule engine's inability to identify implicit semantic risks and serving as the core support for semantic security protection of the large government model.

[0047] The preprocessed unlabeled training corpus is input into the semantic engine, and preliminary optimization is carried out through unsupervised learning to improve the model's ability to understand government terminology and government logic, so that the model can accurately identify professional expressions in the government field.

[0048] By using preprocessed unlabeled corpora (such as a large number of policy documents) for unsupervised learning, the model can initially grasp professional terminology in the field of government affairs (such as social security transfer and business registration) and policy logic (such as the scope of application of policies and the sequence of procedures) without additional labeling costs. This improves the model's basic understanding of government affairs texts and avoids the problem of low training efficiency or poor results caused by the model's unfamiliarity with government affairs knowledge during subsequent supervised training, thus laying a good foundation for supervised training.

[0049] The labeled training corpus was divided into training and validation sets in a 7:3 ratio and input into the preliminarily optimized semantic engine. The gradient descent algorithm was used to adjust the model parameters, with the optimization objectives being ≥98% accuracy in government entity recognition, ≥95% accuracy in intent classification, and ≥92% accuracy in implicit semantic risk recognition. The model was iteratively trained until its performance met the preset threshold.

[0050] Input the validation set into the trained semantic engine. If the performance indicators of the semantic engine do not reach the threshold, supplement the labeled corpus (focusing on supplementing implicit semantic risk samples) and repeat the fine-tuning process until the indicators reach the threshold.

[0051] Dividing the training and validation sets in a 7:3 ratio aligns with the reasonable proportions for machine learning data partitioning. This ensures the training set provides sufficient feature learning samples while the validation set allows for objective evaluation of model performance, preventing overfitting. Employing gradient descent to adjust parameters efficiently optimizes model weights, enabling the model to quickly approach preset targets: ≥98% accuracy in government entity recognition, ≥95% accuracy in intent classification, and ≥92% accuracy in implicit semantic risk identification. This ensures the model performance meets the high accuracy requirements of government scenarios (e.g., incorrect entity recognition may lead to policy interpretation bias, and incorrect intent classification may result in the acceptance of non-government requests). When the validation set falls short, supplementing with implicit risk samples fine-tunes the model, specifically strengthening its ability to identify challenges in government security (implicit semantic risks) and preventing security vulnerabilities caused by insufficient performance in a particular dimension.

[0052] Set detection trigger conditions: The initial detection result of the rule engine on the government affairs big data model input request is 'rule compliance' as the detection trigger condition of the semantic engine. That is, the semantic engine detection process is only triggered after the input request passes the rule engine's sensitive information, access control and format compliance detection.

[0053] The initial check by the rule engine is used as the trigger condition for the semantic engine, thus forming a collaborative mechanism between the rule engine and the semantic engine. The rule engine quickly filters explicit violation requests (such as those containing sensitive words or format errors), avoiding the semantic engine from processing invalid requests, reducing computing power consumption, and improving overall protection efficiency. The semantic engine focuses only on detecting implicit semantic risks that the rule engine cannot cover, concentrating computing power to improve the accuracy of implicit violation identification, thus balancing the efficiency and depth of government security protection.

[0054] The detection execution logic is designed as follows: When the detection is triggered, the semantic engine sequentially calls the government entity identification module to extract government entities from the input request and determine whether there are fictitious / confidential entities, calls the government intent classification module to determine whether the input request intent belongs to the scope of government big model services, and calls the implicit semantic risk judgment module to determine whether there is semantic violation. If any module determines that there is a violation, the semantic violation result (including the violation type) is output. If all modules determine that there is compliance, the semantic compliance result is output.

[0055] The system sequentially calls the government entity identification, intent classification, and implicit semantic risk judgment modules to form a layered detection logic of entity compliance → intent compliance → semantic compliance, covering the core dimensions of semantic violations: first, it checks the authenticity of the entity (e.g., fictitious institutions), then confirms whether the intent is within the scope of government services (e.g., non-government requests), and finally identifies implicit risks (e.g., policy misinterpretation), leaving no blind spots in detection; any module that determines a violation outputs a result, ensuring timely interception of violating requests and preventing risk transmission; outputting the violation type facilitates subsequent tracing of the violation cause, optimization of protection strategies, and provides a clear basis for security audits.

[0056] The model iteration and update mechanism is established to regularly (quarterly) update the training corpus in step 1 based on newly added government data (including newly added policy documents and newly added 12345 hotline data) and historical illegal request cases of the government big data model. The fine-tuning process in step 3 is repeated to optimize the performance of the government-specific semantic model and ensure the model's ability to identify new government scenarios and new semantic risks.

[0057] Receive input requests initiated by users and preprocess the input requests.

[0058] The rules engine performs compliance checks on the preprocessed input requests to determine whether the rules are compliant.

[0059] The string matching algorithm is invoked to compare the request text with politically sensitive samples (politically sensitive words) in the sub-database. If a completely identical sensitive word is found, it is determined to be sensitive information violation (political). If no such word is found, proceed to the next step.

[0060] A string matching algorithm is used to compare politically sensitive words. Violations are only judged when the complete sensitive word appears in the request text, avoiding false blocking caused by sensitive word fragments (such as "politics" or "politics" appearing alone). This ensures the accuracy of blocking politically sensitive information and maintains the political compliance of government affairs scenarios.

[0061] The fuzzy matching algorithm based on edit distance is invoked to calculate the edit distance between the requested text fragment and the sensitive entity samples (undisclosed organization names, classified project codes) in the sub-database. If there is a fragment with an edit distance ≤ 2, it is determined to be a violation of sensitive information (entity class). If not, proceed to the next step.

[0062] A fuzzy matching algorithm with an edit distance ≤ 2 is used to identify typos and abbreviations of classified government entities in the request text (such as "XX City Undisclosed Project Group" mistakenly written as "XX City Undisclosed Item Group"). This fills the blind spot in the identification of variant sensitive entities by precise matching and comprehensively prevents illegal requests related to classified entities.

[0063] The algorithm uses regular expressions to verify whether the request text contains privacy-related sensitive samples (ID card number, social security account number, corresponding to the regular expression \d{17}[\dXx] for an 18-digit ID card number) or policy-related sensitive samples (identifiers for unpublished policy documents, corresponding to the regular expression internal draft for comments - XX〔202X〕XX) from the sub-library. If the verified sensitive fragments have a semantic relationship with the unpublished, classified, or other government-related sensitive contexts, then it is determined to be sensitive information in violation of privacy / policy regulations. If neither exists, then it is determined to be sensitive information compliant.

[0064] By combining regular expressions with government context analysis, regular expressions accurately match structured sensitive information such as ID card numbers (\d{17}[\dXx]) and unpublished policy identifiers (such as internal draft for comments - XX〔202X〕XX), while government context analysis (such as unpublished or classified statements) avoids isolated compliant format fragments (such as simple 18-digit number strings) from being misjudged as private information. This approach protects the security of private data and unpublished policies while reducing the false blocking of normal requests.

[0065] If the sensitive information is compliant, the access control rule sub-library is invoked to determine whether the access control is compliant. The specific equation is as follows: Using the user role identifier as an index, the system matches the preset role-permission-resource mapping rules in the sub-database to determine the scope of accessible government resources (including government knowledge base partitions and large model function modules) and operation permissions (query, interaction, and data export) corresponding to the role.

[0066] Using user role identifiers (such as Civil Affairs - Staff Member - Consultation, Public - None - Query) as indexes, pre-defined role-permission-resource mapping rules are matched to clarify the scope of resources that different roles can access (such as staff members can only access the municipal / county-level policy database, while those at the division level and above can access the national-level policy database) and operation permissions (such as query, interaction, and data export), ensuring that permission allocation aligns with the government's hierarchical and functional needs.

[0067] Analyze the extracted input request content to identify the target resources (such as national policy database resources for consulting national policies, and data export module resources for applying for data export) and operation types corresponding to the user's intent.

[0068] Analyze the content of input requests to identify the target resources (such as consulting national policy databases) and operation types (such as querying or exporting data) corresponding to user intent, providing a clear basis for permission comparison.

[0069] The system compares the user's access rights to resources with the requested target resource and operation type. If they match, the access control is deemed compliant. If the requested target resource exceeds the user's access rights or the operation type is not authorized (e.g., a public user requesting access to a national policy database), the access control is deemed to be in violation.

[0070] By comparing the access permissions of roles with the request requirements, unauthorized requests (such as public roles requesting access to national policy databases or staff members requesting data export) are directly blocked, strictly adhering to the principle of least privilege, and avoiding the risk of leakage of government classified resources due to unauthorized access.

[0071] If access control is compliant, the format compliance rule sub-library is invoked to determine whether the access format is compliant. The specific equation is as follows: Text length detection: Verify whether the number of characters in the requested text is within the range of 1-64k characters (adapted to government Q&A scenarios). If it exceeds the range, it is judged as a format violation (length-related). If it is within the range, proceed to the next step.

[0072] Set the length range to 1-64k characters. The lower limit of 1 character filters empty requests to reduce invalid load on the system. The upper limit of 64k characters adapts to diverse scenarios such as long text policy consultation (such as the need for interpretation of complete policy documents) and short text service inquiries (such as how to handle social security transfer), thereby improving the scenario adaptability of request processing.

[0073] Special character detection: Compare the request text with the list of disabled characters in the sub-database (including SQL injection characters SELECT, INSERT, and script injection characters). <script>、乱码字符),若存在任一禁用字符则判定为格式违规(字符类),若不存在则进入下一步。

[0074] 通过禁用字符清单(含SQL注入字符SELECT,INSERT、脚本注入字符<script>、乱码字符),直接拦截含恶意字符的请求,从源头防范注入攻击、数据篡改等安全风险,保障政务大模型系统运行安全。

[0075] 政务术语格式检测:构建的术语校验库,计算请求文本中政务术语的标准化匹配度,若匹配度≥95%则判定为格式合规,若匹配度<95%或存在≥2个不规范术语(如政务大厅代指政务服务中心)则判定为格式违规(术语类)。

[0076] 通过高匹配度保障政务文本交流的专业性(如避免政务大厅代指政务服务中心导致的理解偏差),又通过宽松阈值允许偶尔笔误(如1处不规范术语),减少正常请求的误判,平衡规范性与用户体验。

[0077] 若访问格式合规,则规则引擎规则合规。

[0078] 若规则合规,则基于语义引擎对预处理后的输入请求输入进行语义合规检测,确定语义是否合规。

[0079] 接收预处理后的输入请求。

[0080] 接收经预处理(文本清洗、拼音-汉字转换、错别字纠正、隐私脱敏等)的输入请求,可直接剔除请求中的冗余空格、乱码、无效字符及已脱敏隐私信息,避免此类干扰信息影响后续语义检测的精准度,同时减少语义引擎对无效数据的处理负载,为后续实体提取、意图分类、风险识别奠定高质量输入基础,提升整体语义检测效率。

[0081] 采用命名实体识别算法(基于BERT预训练模型优化),从输入请求文本中提取政务实体,所述政务实体包括机构名、地名、政策文件名、领导人姓名、涉密项目代号。

[0082] 采用基于BERT预训练模型优化的命名实体识别算法,针对政务场景特有实体(机构名、地名、政策文件名、领导人姓名、涉密项目代号)优化模型参数,相比通用实体识别算法,能更精准地从请求文本中提取政务核心实体,避免将非政务实体(如普通企业名称)误判为政务实体,或遗漏关键政务实体(如涉密项目代号),为后续风险判定提供准确的实体依据。

[0083] 将提取的政务实体与语义引擎内置的政务实体风险库进行比对,所述风险库包含虚构政务实体清单(如XX市虚构审批局)、涉密政务实体清单(如未公开的涉密项目代号)。

[0084] 通过与内置政务实体风险库(含虚构政务实体清单、涉密政务实体清单)比对,可双向防控实体风险:一方面,识别XX市虚构审批局等虚构实体,避免恶意用户通过虚构政务机构套取信息或误导公众;另一方面,对涉密政务实体(如未公开的涉密项目代号)额外关联用户权限校验,仅允许具备涉密访问权限的用户关联此类实体,防止非授权用户通过请求涉密实体获取敏感信息,从实体维度筑牢语义安全防线。

[0085] 若提取的政务实体存在于虚构政务实体清单,或属于涉密政务实体清单且请求用户无涉密访问权限,则判定为语义违规(实体风险类);若实体均为真实、非涉密且与请求上下文匹配(如XX市政务服务中心关联办事指南查询请求),则判定为实体合规。

[0086] 判定实体合规时,额外校验实体与请求上下文匹配度(如XX市政务服务中心需关联办事指南查询等合理请求),避免用户恶意关联无关政务实体(如用国家部委名称关联非政务诉求),确保实体与请求意图的一致性,进一步提升语义合规判定的严谨性。

[0087] 判定为实体合规后,基于TextCNN算法,对输入请求的用户意图进行分类,将意图划分为政策咨询、办事指南查询、政务投诉建议、非政务服务四类。

[0088] 基于TextCNN算法构建意图分类模型,TextCNN在短文本分类场景中具备效率高、精度高的优势,能快速将政务请求意图划分为政策咨询、办事指南查询、政务投诉建议、非政务服务四类,适配政务请求文本通常简短精炼的特点,避免因意图分类延迟影响用户体验,或因分类错误导致后续合规判定偏差。

[0089] 校验分类后的意图是否属于政务大模型预设服务范围(所述服务范围包含政策咨询、办事指南查询、政务投诉建议三类),若不属于则判定为意图违规,若属于则判定为意图合规。

[0090] 通过校验分类意图是否属于政策咨询、办事指南查询、政务投诉建议三类预设服务范围,可直接拦截非政务服务意图(如咨询娱乐信息、商业广告推广、私人生活诉求等),确保政务大模型仅聚焦核心政务服务场景,避免算力资源被非政务请求占用,同时维持政务服务的专业性与针对性,防止大模型输出与政务无关的内容。

[0091] 判定为语义合规后,采用SimCSE算法计算输入请求文本与语义引擎内置语义风险样本库中样本的语义相似度,所述样本库包含历史隐性敏感诉求样本(如以政策解读名义试探涉密信息的文本)、政策曲解诉求样本(如故意扭曲政策条款含义的文本)。

[0092] 采用SimCSE算法计算请求文本与语义风险样本库(含历史隐性敏感诉求、政策曲解诉求样本)的语义相似度,SimCSE算法能有效捕捉文本深层语义关联,相比传统文本匹配算法,可识别表面文本合规、实质语义违规的请求(如以政策解读名义试探涉密信息、截取政策片段曲解整体含义),弥补规则引擎仅能检测显性违规(如敏感词、格式错误)的不足,覆盖语义安全防护的盲区。

[0093] 结合上下文关联分析,判断输入请求是否存在表面文本合规但语义违规的特征:若请求文本包含未公开,涉密等表述且关联非公开政务资源查询,或存在政策条款断章取义表述(如截取政策部分内容曲解整体含义),则触发语义风险标记。

[0094] 通过上下文关联分析(如识别未公开,涉密等表述与非公开政务资源查询的关联、政策条款断章取义表述),触发语义风险标记,可进一步验证语义相似度判定结果的合理性,避免因单纯依赖相似度阈值导致的误判(如请求文本与风险样本语义相似但上下文合规时,不触发违规),平衡风险拦截精度与正常请求通过率。

[0095] 若语义相似度≥85%或存在语义风险标记,则判定为语义违规(隐性风险类);若语义相似度<85%且无风险标记,则判定为语义合规。

[0096] 设定语义相似度≥85%或存在语义风险标记即判定违规,该阈值既确保对高相似度风险样本(如与历史隐性敏感诉求相似度达85%以上)的精准拦截,又避免因阈值过低(如70%)导致大量正常请求被误判;同时,风险标记作为补充判定条件,可覆盖相似度未达阈值但存在明确上下文风险的请求,实现隐性风险的无死角拦截。

[0097] 若语义合规,则输出响应结果。

[0098] 响应结果包括政务答案信息、政策文件原文链接、办事服务事项在线办理入口和相关办事指南下载链接。

[0099] 一种基于规则和语义双引擎的政务大模型应用安全防护系统,如图2所示,包括引擎构建模块,用于构建规则引擎与语义引擎;请求处理模块,用于接收用户发起的输入请求,对所述输入请求进行预处理;规则合规检测模块,用于基于规则引擎对预处理后的输入请求进行合规检测,确定规则是否合规;语义合规检测模块,用于在规则合规,则基于语义引擎对预处理后的输入请求输入进行语义合规检测,确定语义是否合规;响应结果输出模块,用于在语义合规时,输出响应结果。

[0100] 本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。

[0101] 本发明是参照根据本发明实施例的系统、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。

[0102] 这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。

[0103] 这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。

[0104] 尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。

[0105] 显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。< / script>

Claims

1. A government affair big model application security protection method based on a rule and semantic dual engine, characterized in that, The method comprises the following steps: building a rule engine and a semantic engine; receiving a user-initiated input request, preprocessing the input request; performing compliance detection on the preprocessed input request based on the rule engine to determine whether the rule is compliant; if the rule is compliant, performing semantic compliance detection on the preprocessed input request based on the semantic engine to determine whether the semantics are compliant; if the semantics are compliant, outputting a response result.

2. The government affair big model application security protection method based on rule and semantic double engine according to claim 1, characterized in that, The process of building the rule engine includes building a sensitive information rule sub-library, an access control rule sub-library, and a format compliance rule sub-library.

3. The government affair big model application security protection method based on rule and semantic double engine according to claim 2, characterized in that, The process of building the sensitive information rule sub-library is as follows: collecting sensitive information samples and performing type labeling, including political sensitive information, privacy sensitive information, policy sensitive information, and entity sensitive information; using a string exact matching algorithm to adapt political sensitive information samples; using a fuzzy matching algorithm based on edit distance to adapt entity sensitive information samples; using a regular expression algorithm to adapt privacy sensitive information and policy sensitive information samples; associating the labeled sensitive information samples, the adapted matching algorithm, and the pre-set matching rule to form a mapping relationship table, forming the sensitive information rule sub-library.

4. The government affair big model application security protection method based on rule and semantic double engine according to claim 2, characterized in that, The process of building the access control rule sub-library is as follows: establishing a three-dimensional role classification system according to the government department affiliation and work functions, and giving each role a unique role identifier; dividing the associated resources by type, determining the operation permissions corresponding to each type of resource, and forming a resource and operation permission correspondence table; using the role identifier as an index, associating the resource and operation permission correspondence table, and establishing a mapping rule library to form the access control rule sub-library.

5. The government affair big model application security protection method based on rule and semantic double engine according to claim 2, characterized in that, The process of building the format compliance rule sub-library is as follows: determining the reference standard for format compliance, including input text length rules, special character disabling rules, and government terminology format rules, to form the format compliance rule sub-library, specifically: setting the upper limit of the text length to 64k characters and the lower limit to 1 character, if the length of the input text exceeds this range, it is determined to be a length violation; establishing a list of disabled characters, and setting that if the input request contains any character in the list, it is determined to be a character violation; setting that if the standardized matching degree of the government terminology in the input request is lower than the pre-set threshold, it is determined to be a terminology format violation.

6. The government affair big model application security protection method based on rule and semantic double engine according to claim 1, characterized in that, The process of building the semantic engine is as follows: collecting government domain-specific training corpus and preprocessing; annotating the preprocessed training corpus, including government entity labels, user intent labels, and semantic risk labels; building a semantic engine based on a large language model framework; inputting the preprocessed unlabeled training corpus into the semantic engine for preliminary optimization through unsupervised learning; dividing the labeled training corpus into a training set and a validation set in a 7:3 ratio, inputting the preliminary optimized semantic engine, and adjusting the model parameters using the gradient descent algorithm; inputting the validation set into the trained semantic engine, if the performance indicators of the semantic engine do not reach the threshold, supplementing the labeled corpus and repeating the fine-tuning process until the indicators meet the requirements.

7. The government affair big model application security protection method based on rule and semantic double engine according to claim 1, characterized in that, The process of performing compliance detection on the preprocessed input request based on the rule engine to determine whether the rule is compliant is as follows: calling the sensitive information rule sub-library to perform hierarchical detection on the preprocessed input request to determine whether the sensitive information is compliant; If the sensitive information is compliant, the access control rule sub-library is called to determine whether the access control is compliant; If the access control is compliant, the format compliance rule sub-library is called to determine whether the access format is compliant; If the access format is compliant, the rule engine rule is compliant.

8. The government affair big model application security protection method based on rule and semantic double engine according to claim 1, characterized in that, The process of determining whether the semantics are compliant based on the semantic engine for the pre-processed input request input is as follows: Receiving the pre-processed input request; Using a named entity recognition algorithm, extracting government entities from the input request text; Comparing the extracted government entities with the built-in government entity risk library in the semantic engine; If the extracted government entities exist in the list of fictional government entities, or belong to the list of confidential government entities and the request user has no confidential access rights, it is determined that the semantics are in violation; if the entities are all real, non-confidential and match the request context, it is determined that the entities are compliant; After determining that the entities are compliant, the user intent of the input request is classified based on the TextCNN algorithm, and the intent is divided into four categories: policy consultation, guide for doing things, government complaint and suggestion, and non-government service; Verify whether the classified intent belongs to the preset service range of the government large model, if not, it is determined that the intent is in violation, if it belongs to, it is determined that the intent is compliant; After determining that the semantics are compliant, the SimCSE algorithm is used to calculate the semantic similarity between the input request text and the sample in the built-in semantic risk sample library of the semantic engine; If the semantic similarity is greater than or equal to 85% or there is a semantic risk label, it is determined that the semantics are in violation; if the semantic similarity is less than 85% and there is no risk label, it is determined that the semantics are compliant.

9. The government affair big model application security protection method based on rule and semantic double engine according to claim 1, characterized in that, The response result includes government answer information, policy document original text link, online handling entrance of business service matters and related business guide download link.

10. A government affair big model application security protection system based on a rule and semantic dual engine, characterized in that, It includes: Engine building module, for building rule engine and semantic engine; Request processing module, for receiving user-initiated input request, preprocessing the input request; Rule compliance detection module, for performing compliance detection on the pre-processed input request based on the rule engine to determine whether the rules are compliant; Semantic compliance detection module, for performing semantic compliance detection on the pre-processed input request input based on the semantic engine when the rules are compliant, to determine whether the semantics are compliant; Response result output module, for outputting the response result when the semantics are compliant.

Citation Information

Cited By

  • Semantic recognition and judgment system and method oriented to UB interconnection protocol and IO interconnection chip

    CN122111902A

  • A semantic recognition and adjudication system, method, and I / O interconnect chip for the UB interconnect protocol.

    CN122111902B