Document labeling method based on multi-level semantic aggregation and adversarial sensitivity perception

CN122903592APending Publication Date: 2026-10-13BEIJING INST OF COMP TECH & APPL
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610952507.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-29
Publication Date
2026-10-13

AI Technical Summary

Technical Problem

本发明要解决的技术问题是:为克服现有技术层级利用不足、稀疏场景误判、词库明文泄密、抗规避能力弱、无法溯源审计、难以动态适配的缺陷,提供一种基于多层级语义聚合与对抗敏感度感知的文档自动标密方法及系统

Benefits of technology

本发明首创密态双通道分级匹配+句子定向对抗增强+段落双分支密度自适应补偿复合判定架构,构建不可逆分级盐值哈希精确匹配+分层动态衰减语义模糊匹配双通道词级判定;搭配涉密术语定向对抗扰动、密级间隔加权对比学习强化模型抗规避能力;设计双曲正切双分支密度补偿函数解决低密度高敏感段落漏判;依托HSM+TEE分级隔离存储、TEE缓存自动清零实现敏感词库全生命周期无明文泄露;配套原子同步切换词库热重载、种子词风险打分自动扩词、四级分层水印溯源审计机制,实现词-句-段-篇四级递进密级判定与字符级敏感片段溯源;兼顾定密精度、对抗鲁棒性、词库存储安全、合规可追溯与跨领域动态扩展,适配国产化涉密软硬件部署环境。

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The present application relates to a kind of document mark method based on multi-level semantic aggregation and sensitivity perception of confrontation, belong to computer security technology and other technical fields.The present application initiates secret state double-channel hierarchical matching+sentence directional confrontation enhancement+paragraph double-branch density adaptive compensation composite determination architecture, constructs irreversible hierarchical salt value Hash accurate matching+layered dynamic attenuation semantic fuzzy matching double-channel word level determination;With secret technical term directional confrontation disturbance, secret level interval weighted comparison learning reinforcement model anti-avoidance ability;Design hyperbolic tangent double-branch density compensation function to solve low-density high-sensitive paragraph missed judgment;Rely on HSM+TEE hierarchical isolation storage, TEE cache automatic zero clearing realizes sensitive word library full life cycle without plaintext leakage;Support atomic synchronous switching word library hot reloading, seed word risk scoring automatic word expansion, four-level layered watermark traceability audit mechanism, realize word-sentence-paragraph-four progressive secret level determination and character-level sensitive fragment traceability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of computer security technology, trusted execution environment, artificial intelligence deep learning, natural language processing, and classified information identification and intelligent management and control technology. Specifically, it relates to a document classification method based on multi-level semantic aggregation and adversarial sensitivity perception. Background Technology

[0002] In key sectors such as industrial manufacturing, defense technology, and energy, there are massive amounts of classified documents, including technical design documents, test reports, process specifications, and production ledgers. These documents contain core technical parameters, key process flows, and classified business data. Accurate and unified classification labeling is the basic prerequisite for classified control, document circulation, and security auditing.

[0003] Traditional classification of classified documents relies entirely on manual review and labeling, which has problems such as large differences in subjective judgment, inconsistent classification standards, low processing efficiency, difficulty in handling large batches of documents, and inability to accurately trace sensitive points.

[0004] Existing deep learning-based automatic key delimitation solutions mostly employ pre-trained language models for end-to-end document-level overall classification, but still suffer from the following key drawbacks: 1. Ignoring the natural word-sentence-paragraph-article hierarchical structure of documents and only performing global classification makes it impossible to achieve fine-grained sensitive point location and traceability. 2. For low-density, high-sensitivity paragraph scenarios, where only a few sentences within a paragraph contain highly sensitive content and the proportion of sensitive sentences is low, traditional max pooling and global average aggregation tend to dilute sensitive features, leading to missed detections and under-scoring. 3. Sensitive word databases are mostly stored in plaintext, and plaintext entries are loaded during the matching process, posing a risk of the entire database being leaked if the system is compromised; 4. The model is not robust enough against malicious circumvention behaviors such as synonym replacement, word order change, abbreviation rewriting, misspelling and confusion, and splitting and splicing sensitive information, and is easily bypassed; 5. Traditional sensitive word binary matching cannot be integrated with semantic continuous confidence judgment within the same framework, and lacks a quantitative progressive judgment mechanism; 6. It lacks structured traceability reports and audit record keeping capabilities, which does not meet the compliance requirements of national secrecy classification and traceability and post-event auditing; at the same time, it cannot support hot updates of the thesaurus and rapid cross-domain migration after changes in the secrecy classification policy.

[0005] 7. Existing semantic matching uses a globally fixed similarity threshold and a fixed confidence decay coefficient, which cannot be adjusted for the five levels of security. High-density terms are prone to being missed, and low-density terms are prone to being falsely labeled. It also lacks a dual-channel conflict resolution mechanism, and cannot automatically handle conflicts between polysemous words and cross-security levels. 8. The existing thesaurus updates only synchronize the hash index, without synchronizing the semantic embedding vector, resulting in a significant decrease in semantic matching accuracy after the update; there is no pre-filtering of candidate word risk scoring, making manual word expansion and review extremely costly; and there is a lack of an audit watermark anti-tampering mechanism, failing to meet the compliance requirements for confidentiality post-verification.

[0006] In summary, existing technologies have significant shortcomings in hierarchical judgment, sparse sensitivity identification, thesaurus security, anti-attack, compliance traceability, dynamic expansion, differentiated security level control, and synchronous iterative auditing and anti-tampering capabilities of thesaurus. There is an urgent need for an automatic document security labeling solution that is hierarchical, fine-grained, traceable, robust against attacks, stores thesaurus in a secure state, supports hot update expansion, and has the ability to adaptively control and prevent tampering of security levels. Summary of the Invention

[0007] (a) Technical problems to be solved The technical problem to be solved by this invention is to overcome the shortcomings of existing technologies, such as insufficient utilization of hierarchical levels, misjudgment in sparse scenarios, plaintext leakage of the thesaurus, weak anti-circumvention capabilities, inability to trace and audit sources, and difficulty in dynamic adaptation, and to provide a method and system for automatic document encryption based on multi-level semantic aggregation and adversarial sensitivity awareness.

[0008] (II) Technical Solution To address the aforementioned technical problems, the present invention provides...

[0009] (III) Beneficial Effects This invention pioneers a composite judgment architecture combining closed-state dual-channel hierarchical matching, sentence-oriented adversarial enhancement, and paragraph dual-branch density adaptive compensation. It constructs an irreversible hierarchical salt value hash precise matching and hierarchical dynamic decay semantic fuzzy matching dual-channel word-level judgment. Combined with targeted adversarial perturbation of classified terms and weighted comparative learning based on classification level intervals, it enhances the model's anti-evasion capabilities. A hyperbolic tangent dual-branch density compensation function is designed to address missed judgments of low-density, highly sensitive paragraphs. Relying on HSM+TEE hierarchical isolated storage and automatic TEE cache clearing, it achieves no plaintext leakage of the sensitive word library throughout its entire lifecycle. It is complemented by atomic synchronous switching of the word library for hot reloading, automatic word expansion through seed word risk scoring, and a four-level hierarchical watermarking traceability audit mechanism, realizing four-level progressive classification judgment (word-sentence-paragraph-article) and character-level sensitive segment traceability. It balances classification accuracy, adversarial robustness, word library storage security, compliance traceability, and cross-domain dynamic expansion, and is compatible with domestically produced classified software and hardware deployment environments. Detailed Implementation

[0010] To make the objectives, contents, and advantages of the present invention clearer, the specific embodiments of the present invention will be described in further detail below with reference to examples.

[0011] The purpose of this invention is to overcome the shortcomings of existing technologies, such as insufficient utilization of hierarchical levels, misjudgment in sparse scenarios, plaintext leakage of the thesaurus, weak anti-circumvention capabilities, inability to trace and audit sources, and difficulty in dynamic adaptation. It provides a method and system for automatic document encryption based on multi-level semantic aggregation and adversarial sensitivity awareness. This invention pioneers a composite judgment architecture combining closed-state dual-channel hierarchical matching, sentence-oriented adversarial enhancement, and paragraph dual-branch density adaptive compensation. It constructs an irreversible hierarchical salt value hash precise matching and hierarchical dynamic decay semantic fuzzy matching dual-channel word-level judgment. Combined with targeted adversarial perturbation of classified terms and weighted comparative learning based on classification level intervals, it enhances the model's anti-evasion capabilities. A hyperbolic tangent dual-branch density compensation function is designed to address missed judgments of low-density, highly sensitive paragraphs. Relying on HSM+TEE hierarchical isolated storage and automatic TEE cache clearing, it achieves no plaintext leakage of the sensitive word library throughout its entire lifecycle. It is complemented by atomic synchronous switching of the word library for hot reloading, automatic word expansion through seed word risk scoring, and a four-level hierarchical watermarking traceability audit mechanism, realizing four-level progressive classification judgment (word-sentence-paragraph-article) and character-level sensitive segment traceability. It balances classification accuracy, adversarial robustness, word library storage security, compliance traceability, and cross-domain dynamic expansion, and is compatible with domestically produced classified software and hardware deployment environments.

[0012] This invention provides an automatic document classification method based on multi-level semantic aggregation and adversarial sensitivity awareness. Specifically, it relates to an intelligent automatic classification method and system for key national classified fields such as industrial manufacturing, defense technology, energy and power, aerospace, and rail transportation. This method relies on hardware security encryption architecture, multi-level semantic understanding, and adversarial machine learning technology to achieve document sensitive information mining, intelligent classification level determination, fine-grained sensitivity tracing, and classified term library management. It is particularly suitable for classifying unstructured texts such as classified technical documents, test reports, production ledgers, and design drawings, and is adaptable to domestically produced classified software and hardware deployment environments. It belongs to the cross-disciplinary technical fields of security, artificial intelligence text analysis, and information security management. The method includes the following steps: S1. Secure Construction and Encrypted Storage of Classified Sensitive Word Database This step completes the standardized construction of a classified sensitive knowledge base, hierarchical labeling of entries, encryption processing, and security solidification, outputting a classified multi-level sensitive word library, providing secure and reliable underlying data support for the word-level dual-channel sensitivity determination in step S3. First, based on the "Regulations on the Management of State Secrets," industry data classification standards, and combined with the characteristics of classified business in various fields, classified industry terms, special parameters, process terms, and classified business vocabulary are collected as raw word materials. The Delphi expert scoring method is used to complete the classification of all entries, establishing a five-level classification system, and simultaneously labeling each entry with three basic tags: the business field to which the entry belongs, the sensitive semantic type, and the risk description tag. Second, encrypted hash conversion is performed on all raw entries. The HMAC-SHA256 irreversible key hash algorithm is used to calculate the hash fingerprint of each entry, constructing a classified index library with hash values ​​as the unique retrieval index, without storing plaintext entries throughout the process. To enhance metadata storage security, the term security level tags, semantic attributes that integrate sensitive semantic types and business domains, and risk description tags are encapsulated into independent attribute data blocks. Each attribute data block is encrypted and stored separately using a national standard-compliant AES-256-GCM symmetric encryption algorithm. The hash fingerprint calculation, attribute block encryption / decryption, and subsequent S3 hash matching operations all rely on a hardware-level hierarchical encryption architecture for secure isolation: a non-derivative encryption root key is generated by the Hardware Security Module (HSM), and a temporary session key is dynamically generated within the Trusted Execution Environment (TEE) using the HKDF key derivation function; all key operations, hash comparisons, and data encryption / decryption operations are isolated within the TEE's secure encryption zone, ensuring that no plaintext terms are stored in external memory or on disk, thus achieving full lifecycle security management of the encrypted sensitive term library.

[0013] In summary, this step fully constructs a multi-level encrypted sensitive word library in the domain. The core implementation logic is as follows: HMAC-SHA256 irreversible hashing is used to generate a hash index for each word; the security level attribute block and semantic attribute block corresponding to each word are independently encrypted and stored; the root key is generated by HSM, and the session key is derived in the TEE through HKDF. The hash calculation and matching process runs entirely in the TEE, achieving the goal of no plaintext storage of the sensitive word library.

[0014] S2, Multi-level document preprocessing This step, based on the classified domain-optimized word segmentation dictionary output in step S1, transforms unstructured raw documents into standardized hierarchical text structures, outputting a four-level nested topology of document-paragraph-sentence-vocabulary with character position anchors. This provides a standardized input for word-level dual-channel sensitivity determination in step S3. First, the uploaded raw document to be classified is parsed, removing whitespace characters, invalid line breaks, and redundant formatting characters, retaining only the plain text business content. Automatic paragraph segmentation is performed based on document layout features and paragraph separators, achieving logical paragraph boundary recognition. Based on paragraph segmentation, precise sentence segmentation is performed using punctuation and sentence structure rules, distinguishing between declarative sentences, technical description sentences, and annotation sentences, preserving the semantic integrity of sentence boundaries. Subsequently, a word segmentation dictionary optimized for classified industrial corpora is used to perform Chinese word segmentation, simultaneously completing part-of-speech tagging, distinguishing between nouns, professional verbs, and limiting modifiers, and filtering stop words and meaningless function words. The final structure forms a four-level nested hierarchical topology of document-paragraph-sentence-vocabulary, recording the character offset, start and end positions, and hierarchical relationships of each word, sentence, and paragraph in the original document, providing a location anchoring basis for subsequent sensitive source tracing and key point location.

[0015] In summary, this step performs a complete process of format cleaning, paragraph segmentation, sentence segmentation, Chinese word segmentation, and part-of-speech tagging on the input document, and uniformly constructs a four-level nested hierarchical topology of document-paragraph-sentence-vocabulary. The bottom unit of this structure is the segmented vocabulary.

[0016] S3, Word-level Dual-channel Sensitivity Determination This step, based on the encrypted hash index library and encrypted sensitive word embedding vector set output by S1, and the four-level nested topology structure of document-paragraph-sentence-vocabulary output by S2 (with the underlying word segmentation vocabulary as input), innovatively constructs a dual-channel judgment architecture that combines encrypted precise matching and semantic fuzzy matching. This architecture balances the accurate hit of hard rules with the recognition of soft semantic associations, solving the problem of insufficient recognition coverage of a single matching method.

[0017] Secure and precise matching channel: Within the trusted execution environment, the segmented words in the S2 topology are read and hash recalculation is completed to generate a real-time hash fingerprint. This fingerprint is then compared with the encrypted hash index pre-built in the S1 encrypted index library. The entire comparison process involves no plaintext word parsing or loading. If the hash fingerprints are completely identical, it is determined to be a precise match. The standard security level of the word is then directly decrypted and read, and a maximum confidence level of 1.0 is assigned to it, generating a rigid word-level sensitivity score.

[0018] Semantic Fuzzy Matching Channel: For words segmented that do not match the hash of the precise matching channel, a context-aware semantic matching mechanism is enabled. A dynamic context embedding vector of the current word in the context of the sentence is extracted based on the ERNIE 3.0 pre-trained language model, thus eliminating the ambiguity defects of static word vectors. Then, this dynamic context embedding vector is used to perform batch cosine similarity calculation with the pre-stored encrypted sensitive word embedding vector set in the S1 encrypted sensitive word library, and the associated words with the highest similarity are selected. After completing the vector similarity calculation, the Youden exponent maximization criterion is used to traverse and optimize within the industry validation set to determine the optimal similarity threshold to balance precision and recall. When the cosine similarity (i.e., semantic similarity) of a candidate word is greater than this optimal threshold, it is determined as a semantic association hit. A flexible word-level sensitivity is then generated by combining the security level and semantic similarity score of the matched word. Considering the risk of contextual ambiguity in semantic matching, a confidence decay coefficient of 0.9 is uniformly set to correct the score.

[0019] After obtaining rigid and flexible sensitivity scores from the two channels respectively, confidence fusion is completed using differentiated weights. This retains the high reliability of accurate matching while also being compatible with the generalized recognition capability of semantic matching. Finally, a refined word-level sensitivity matrix that is quantified, sortable, and traceable is output for use in S4 sentence-level adversarial sensitivity analysis.

[0020] In summary, the core judgment logic of the dual channels can be summarized as follows: Secure and precise matching channel: The hash of the segmented words is calculated within the TEE and compared with the S1 encrypted hash index. Upon a match, the standard security level and word-level baseline sensitivity are directly obtained. Semantic fuzzy matching channel: When the hash does not match, the dynamic contextual semantic embedding of the words is extracted and the cosine similarity is calculated with the embedding vector of the sensitive word library. If the value exceeds the optimal threshold obtained by Yoden index optimization, the word security level and similarity are combined for weighted scoring. The dual channels use differentiated weights of 1.0 and 0.9 respectively to complete the confidence fusion and output the final word-level sensitivity.

[0021] S4. Sentence-level adversarial sensitivity analysis This step, based on the refined word-level sensitivity matrix output by S3 and the standardized sentence-level text output by S2, uses a single sentence as the smallest semantic analysis unit. It combines prompting engineering and adversarial contrastive learning to optimize the model, enhancing its ability to resist malicious semantic perturbations such as synonym substitution and word order manipulation. First, considering the strict sentence structure and dense technical terminology of industrial confidential documents, a customized industry-specific prompt template is developed. The original sentences parsed by S2 are embedded into a fixed prompt sentence pattern, guiding the model to focus on sensitive semantic elements within the sentence and filter out irrelevant interfering text. The encapsulated prompt sentence is then input into a specially fine-tuned ERNIE3.0 pre-trained language model, where the model's multi-layered Transformer structure performs deep semantic feature extraction. During model training, a joint optimization mechanism combining adversarial perturbation enhancement and self-supervised contrastive learning is introduced: After the word embedding layer output and before Transformer encoding, a small L2 normalized perturbation is applied to the embedding tensor along the loss gradient direction, with a fixed perturbation radius of 0.01. This generates adversarial enhancement samples without disrupting the original semantic meaning of the sentence, simulating various evasion-based tampering behaviors. A joint loss function is constructed, consisting of cross-entropy classification loss and self-supervised contrastive loss, where cross-entropy loss constrains the convergence effect of density-level classification; the self-supervised contrastive loss sets the original sentence and its corresponding adversarial enhancement sample as positive pairs, and sentences within the same batch with a density level difference of two or more levels as negative pairs, widening the semantic feature gap between sentences of different density levels and strengthening the feature boundary differentiation effect of each density level. During forward inference, the model outputs a density level probability distribution of 1 to 5 levels, selecting the level corresponding to the highest probability as the sensitivity level of the current sentence, and outputting a sentence sensitivity set for use in S5 paragraph aggregation.

[0022] In summary, the core process of sentence-level sensitivity determination in this step can be summarized as follows: constructing a domain-specific prompt template and inputting it into a pre-trained language model; training the model using adversarial fine-tuning combined with self-supervised contrastive learning, applying gradient adversarial perturbations after word embedding output and before Transformer encoding to generate an adversarial enhanced view; the overall loss is jointly calculated by cross-entropy loss and self-supervised contrastive loss, iteratively optimizing the model with original samples-adversarial samples as positive pairs and samples of different density levels within a batch as negative pairs; during the inference stage, outputting the probability distribution of each density level of the sentence, and determining the sentence sensitivity based on the maximum probability.

[0023] S5, Paragraph-level Density Adaptive Aggregation This step, based on the paragraph-sentence hierarchical relationship output by S2 and the sensitivity results of all sentences output by S4, addresses the shortcomings of traditional global pooling methods in missing low-density, highly sensitive paragraphs and underestimating their density level, and completes the paragraph-dimensional sensitive semantic fusion and classification.

[0024] First, iterate through all sentences in a single paragraph, filter out medium-to-high sensitivity sentences with a sensitivity level of ≥3, and calculate the ratio of such sentences to the total number of sentences in the paragraph as the sensitivity density of this paragraph; at the same time, extract the maximum value of the sensitivity of all sentences in this paragraph as the basic sensitivity benchmark value of the paragraph.

[0025] A continuous, differentiable, smooth, and bounded hyperbolic tangent density compensation function is introduced to dynamically compensate for paragraph-sensitive clustering features. This function has three built-in hyperparameters: compensation intensity coefficient, kurtosis coefficient, and density critical threshold. During inference, pre-trained hyperparameter combinations are automatically loaded based on the current document's industry tags. It also supports online fine-tuning. After batch document inference, missed / falsely labeled samples are collected to slightly correct the hyperparameters in reverse, without retraining the backbone model. It adapts to cross-domain documents without manual parameter tuning.

[0026] A density threshold ρ0 is set as the branch switching boundary: paragraph sensitivity density < ρ0 enters the sparse suppression branch, where the compensation function rises gently to suppress false labeling; density ≥ ρ0 enters the aggregation gain branch, where the function steeply amplifies the sensitivity score, automatically upgrading the security level, with a smooth transition between the two branches without abrupt changes. During model training, floating-point continuous compensation values ​​are retained for gradient backpropagation to ensure end-to-end trainability of the entire network; during actual inference and deployment, the compensation results are truncated and rounded, forcibly mapped to a discrete security level range of 1-5, conforming to national security classification standards. Finally, the basic sensitivity benchmark value of the paragraph is compared with the density compensation calculation result, and the larger value is taken as the final paragraph sensitivity: if sensitive sentences are sparsely distributed within the paragraph, the compensation gain is weak to avoid false labeling of the security level; if highly sensitive sentences are locally concentrated, the risk weight is automatically amplified to achieve a reasonable upgrade of the security level. All paragraph security level results are output to S6 for global document classification.

[0027] In summary, the core logic of this paragraph aggregation is as follows: the paragraph sensitivity density is obtained by statistically analyzing the proportion of highly sensitive sentences within the paragraph; a smooth and bounded hyperbolic tangent density compensation function is used in conjunction with a sparse / clustered dual-branch switching mechanism for gain correction; and industry-adaptive online hyperparameter tuning is provided. During training, floating-point compensation values ​​participate in gradient backpropagation; during the inference phase, the results are truncated, rounded, and constrained to the standard density level range; finally, the larger of the paragraph's maximum sentence sensitivity and the density compensation result is taken as the paragraph's final sensitivity.

[0028] S6. Generation of document-level global confidentiality and traceability reports This step, based on the full-text character position anchoring information recorded in S2, the full document paragraph sensitivity set output in S5, and the pre-stored security level prototype vectors in S1, integrates the local statistical features of paragraphs with the global semantic features of the document to complete the comprehensive security level determination of the entire document, and simultaneously generates a structured traceability report that meets audit compliance requirements and can accurately locate sensitive points.

[0029] First, the security classification distribution of all paragraphs in the full text is statistically analyzed, a histogram of paragraph security classification distribution is constructed, and the proportion of each security classification paragraph is calculated to form the statistical features of the document structure. Then, the complete full text is input into the pre-trained model to extract the global semantic representation vector of the document hierarchy, capturing the overall business direction and core confidential themes of the document.

[0030] The security level prototype vectors are initialized using the semantic mean of documents of the same level within the training set. A high-momentum exponential moving average strategy of 0.99 is used for slow iterative updates to ensure the stability and strong representativeness of the prototype vectors. The cosine similarity between the document's global semantic vector and the prototype vectors of each security level is calculated to obtain a semantic fit score between the document and each security level. Two types of features are weighted and fused using paragraph structure statistical features (weight 0.55) and semantic projection similarity (weight 0.45) to calculate the comprehensive score for each security level of the document. The highest score is selected as the document's base security level.

[0031] Establish a layered, bottom-line linkage mechanism: if a paragraph contains a Level 4 confidential segment, the paragraph will be classified as at least Level 4; if the entire text contains a Level 5 top-secret sensitive segment, the entire text will be classified as Level 5; if the highest classification of multiple paragraphs is inconsistent, the highest classification of the entire document will be automatically taken, and the positions of all high-class segments will be marked in the report. This solves the problem of local high-class segments being diluted and underclassified by the global average, and prevents the leakage of highly classified documents due to underclassification.

[0032] Finally, the full-process sensitivity detection data from S3 (word level), S4 (sentence level), and S5 (paragraph level) are integrated to generate a structured traceability report in JSON format. The report includes four levels of independent audit watermarks: words, sentences, paragraphs, and documents. The watermarks are bound to the operator's ID, the time of classification, and the document's hash value. Modifications to any sensitive point at any level will synchronously change the watermark verification value, supporting tamper verification by confidentiality management departments. The report includes fields such as document number, paragraph index, sentence index, sensitive word start and end character offsets, sensitivity scores at each level, and classification criteria. All fields are anchored to the original document's character coordinates, supporting highlighting of the original text in the background, manual review, and full-process audit traceability.

[0033] In summary, the core logic of document classification and source tracing in this step can be summarized as follows: extract the global semantic representation vector of the document, integrate two types of features—paragraph security level statistical distribution and security level prototype semantic projection—to calculate the basic security level of the full text; overlay multi-level hierarchical fallback linkage rules to correct the document security level; and output a structured traceability report with built-in four-level anti-tampering audit watermark, paragraph index, sentence index, sensitive word character offset, and sensitivity scores at each level, to achieve accurate location of sensitive points in the original text and full audit traceability.

[0034] S7, Dictionary Hot Reload and Automatic Expansion This step relies on the encrypted storage architecture of the encrypted sensitive word library built by S1 and the dual-channel semantic matching calculation logic of S3 to realize dynamic iteration, non-stop updates, and low-cost migration across domains of the encrypted sensitive word library. It adapts to actual business scenarios such as changes in confidentiality policies and expansion of business domains. The updated complete encrypted sensitive word library can be fed back to S3 for continuous word-level sensitivity determination.

[0035] To address the requirements for dictionary changes such as adjusting the security level of entries, discarding old entries, and adding new classified terms, the system adopts a dual-buffered-slot memory architecture. The memory simultaneously maintains two types of storage areas: active index slots and backup index slots. The new hash index, encrypted entry attribute blocks, and encrypted sensitive word embedding vectors are completely written into the backup index slot. The version numbers of the three are strongly bound, and atomic pointers are executed synchronously to instantly switch and complete the dictionary version replacement. After verifying the integrity of the hash, the same version index is locked throughout the entire document classification reasoning process to avoid the confusion caused by the mixing of old and new entries and semantic vectors. The entire update process does not require service downtime and does not interrupt online classification services.

[0036] To address the high cost of building a sensitive word library from scratch in a completely new business domain, an automatic word expansion mechanism based on seed words is designed: A small number of domain seed sensitive words are manually entered, and strong co-occurring related words are mined from a large-scale unlabeled corpus of the domain using a pre-trained language model to construct an initial set of candidate words; a domain association risk score is calculated for the mined co-occurring candidate words, and a risk score of 0 to 5 is generated by combining word frequency and the number of sensitive co-occurrences in context, and only candidate words with a risk score ≥2 enter clustering and manual review; semantic clustering algorithm is used to remove semantically irrelevant discrete words, and only professional terms that fit the domain business are retained; the candidate new words go through a three-level review process of machine initial screening, manual review by confidentiality management personnel, and secondary verification of confidentiality level. After the review is passed, the hash encryption, attribute data block encapsulation, hash index and embedding vector are updated synchronously according to the complete S1 process, and the domain sensitive word library is expanded at low cost and high efficiency.

[0037] In summary, the core implementation method of the thesaurus iteration in this step can be summarized as follows: adopting a dual-buffered slot combined with an atomic pointer synchronous switching mechanism to achieve hot reloading of the encrypted hash index, attribute block, and semantic vector without downtime; mining co-occurring related words based on domain seed sensitive words, combined with candidate word risk scoring for pre-filtering, and completing new word expansion through semantic clustering and three-level compliance review, while simultaneously updating the complete set of encrypted indexes and semantic vector libraries in S1 specification format.

[0038] This invention also provides an automatic document encryption system based on multi-level semantic aggregation and adversarial sensitivity awareness. The system adopts a domestically produced trusted hardware architecture and a modular, layered design, including a trusted execution environment processor, a physical encryption chip, a power-off erasure memory, and a computer execution program stored in the memory. At the hardware level, key generation and encryption operations are completed using a hardware security module; at the software level, fully automated encryption is achieved through modular program collaboration. When the system program is executed by the processor, it specifically implements the following functional modules: 1. Sensitive word library construction and security management module: used to build a domain-level sensitive word library, implement word hash index construction based on HMAC-SHA256, and independently encrypt and store the security level and semantic attribute blocks; it connects with the hardware security module to complete root key generation and session key derivation, and supports automatic expansion of the word library and double buffer hot reload; 2. Document preprocessing module: This module is used to segment the input document to be coded into paragraphs, sentences, words, and parts of speech, generating a four-level hierarchical structured text sequence. 3. Word-level dual-channel sensitivity determination module: Deploys dual-pathway dense-state precise matching and semantic fuzzy matching to complete word hash comparison and context semantic vector similarity calculation, realize dual-channel differential weight reset confidence fusion, and output quantitative word-level sensitivity; 4. Sentence-level multi-category sensitivity analysis module: It has a built-in pre-trained language model trained by adversarial fine-tuning and self-supervised contrastive learning, and uses domain prompt templates to predict the probability distribution of sentence density level and output the sentence sensitivity level. 5. Paragraph-level density adaptive aggregation module: used to calculate paragraph sensitivity density, call the density compensation function to complete the dynamic compensation of maximum sentence sensitivity, and aggregate to obtain the final paragraph-level sensitivity; 6. Document-level Global Classification and Source Traceability Report Module: Extracts global semantic representation of the document, integrates paragraph statistical features and classification prototype semantic projection, and weights to determine the full-text classification level; generates a structured sensitive segment traceability report with character offsets, supporting audit trails and original text location; 7. Access Control and Domestic Adaptation Module: Enables hierarchical access control for operators, records the confidentiality logs, operation paths, and version records for each document; adapts to Phytium / Kunpeng domestic chips and Kylin domestic operating system, and is compatible with classified domestic deployment environments.

[0039] Example 1: Automatic document encryption in industrial manufacturing A 3200-word Level 5 sensitive word database was constructed based on industry standards. A hash index was generated using independent random salt + HMAC-SHA256, and attribute blocks were encrypted with AES-256-GCM. Documents were segmented hierarchically and then subjected to dual-channel word-level judgment. The semantic similarity threshold of 0.82 was obtained by searching the Youden index. The model's adversarial perturbation radius ε=0.01, contrast loss coefficient α=0.15, and temperature τ=0.07. Paragraph compensation parameters γ=0.25, β=15, and ρ0=0.15 were used. At the document level, a fusion decision of 0.55 paragraph statistics + 0.45 semantic prototype was adopted, and if the highest-level sensitive segment existed, it was directly assigned the lowest level. A JSON structured traceability report was output.

[0040] On a test set of 1,200 industrial documents, the overall accuracy rate for determining the classification level of the entire document reached 95.18%. When a balanced approach was used to comprehensively evaluate classified paragraphs at all levels, the F1 score for paragraph-level comprehensive identification reached 92.37%. Under adversarial and evasion attacks, the accuracy rate only dropped by about 4 percentage points, and the robustness was significantly better than that of traditional solutions.

[0041] Example 2: Dynamic Update of Security Level and Cross-Domain Expansion It achieves non-stop hot reload through double-buffered index slots; it completes co-occurrence mining and clustering review of new domains with a small number of seed words, and quickly generates sensitive word library and hash index for new domains, adapting to migration in scenarios such as energy and defense.

[0042] It can be seen that the present invention has the following advantages: 1. Implements a four-level progressive judgment system: word-sentence-paragraph-article, supports character-level sensitive segment tracing, and meets the requirements for confidentiality auditing and record keeping; 2. Dual-channel matching + density compensation effectively solves the problems of missed and false positives in low-density, high-sensitivity scenarios; 3. Adversarial fine-tuning and contrastive learning significantly improve the model's ability to avoid synonym substitution, word order manipulation, and other similar issues; 4. HSM+TEE encrypted storage ensures that the sensitive word database is entirely free of plaintext, preventing secondary leaks; 5. Supports hot reloading, automatic keyword expansion, and cross-domain migration, adapting to policy changes and multi-industry implementation; 6. It is compatible with domestically produced software and hardware and meets confidentiality compliance requirements, making it highly feasible for engineering implementation.

[0043] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A document encryption method based on multi-level semantic aggregation and adversarial sensitivity awareness, characterized in that, Includes the following steps: S1. Secure Construction and Encrypted Storage of Classified Sensitive Word Database This step completes the standardized construction of the classified sensitive word database, hierarchical labeling of entries, encryption processing and security solidification, and outputs an optimized word segmentation dictionary for classified fields, providing secure and reliable underlying data support for the word-level dual-channel sensitivity determination in step S3; S2, Multi-level document preprocessing This step is based on the classified domain optimized word segmentation dictionary output in step S1, realizing the conversion of unstructured raw documents into standardized hierarchical text structures, and outputting a four-level nested hierarchical topology structure of document-paragraph-sentence-vocabulary with character position anchoring information, providing input for word-level dual-channel sensitivity determination in step S3; S3, Word-level Dual-channel Sensitivity Determination This step directly reads all the segmented words in the four-level nested hierarchical topology generated in step S2 as the input object for dual-channel matching. At the same time, it performs word-level dual-channel sensitivity determination based on the character positions and sentence subordination relationships recorded in the four-level nested hierarchical topology and generates a word-level sensitivity matrix. S4. Sentence-level adversarial sensitivity analysis This step, based on the word-level sensitivity matrix output in step S3, takes a single sentence as the smallest semantic analysis unit, combines cueing engineering and adversarial contrastive learning to optimize the pre-trained language model, performs sentence-level adversarial sensitivity analysis, and generates a sentence sensitivity set. S5, Paragraph-level Density Adaptive Aggregation Based on the paragraph-sentence hierarchical relationship obtained in step S2 and the sentence sensitivity set output in step S4, this step completes the paragraph-dimensional sensitive semantic fusion and classification, and generates the confidentiality level results of all paragraphs, i.e., the paragraph sensitivity set of the document. S6. Generation of Document-Level Global Confidentiality and Traceability Reports This step, based on the character position anchoring information of the entire document recorded in step S2, the paragraph sensitivity set of the entire document output in step S5, and the pre-stored prototype vectors of each level of security classification, integrates the local statistical features of paragraphs with the global semantic features of the document to complete the comprehensive security classification determination of the document.

2. The method as described in claim 1, characterized in that, In step S1, firstly, based on the "Regulations on the Management of State Secrets," industry data grading standards, and the characteristics of classified business in various fields, classified industry terms, special parameters, process terms, and classified business vocabulary are collected as raw terminology materials. The Delphi expert scoring method is used to classify all terms, establishing a five-level classification system. Simultaneously, three basic tags are assigned to each term: the business field to which the term belongs, sensitive semantic types, and risk description tags. Secondly, encrypted hash conversion is performed on all raw terms. The HMAC-SHA256 irreversible key hash algorithm is used to calculate the hash fingerprint of each term, constructing a classified index library with hash values ​​as the unique retrieval index, without storing plaintext terms throughout the process. The term classification tags, semantic attributes integrating sensitive semantic types and business fields, and risk description tags are encapsulated into independent attribute data blocks. Each attribute data block is encrypted and stored separately using a national cryptographically compatible AES-256-GCM symmetric encryption algorithm, ultimately forming an optimized word segmentation dictionary for classified fields.

3. The method as described in claim 1, characterized in that, In step S2, the uploaded original document to be classified is first parsed to remove blank characters, invalid line breaks, and redundant formatting characters, retaining only the plain text business content. Automatic paragraph segmentation is then performed based on document layout features and paragraph separators to identify logical paragraph boundaries. Based on paragraph segmentation, sentences are further segmented using punctuation and sentence structure rules to distinguish between declarative sentences, technical descriptions, and annotations, preserving the semantic integrity of sentences. Subsequently, a classified domain-optimized word segmentation dictionary is used to perform Chinese word segmentation, simultaneously completing part-of-speech tagging to distinguish between nouns, technical verbs, and limiting modifiers, filtering out stop words and meaningless function words. Finally, a four-level nested hierarchical topology of document-paragraph-sentence-vocabulary is constructed, recording the character offset, start and end positions, and hierarchical relationships of each word, sentence, and paragraph in the original document. This provides a location anchoring basis for subsequent sensitive source tracing and classified point location. The lowest level unit of this four-level nested hierarchical topology is the segmented vocabulary.

4. The method as described in claim 1, characterized in that, In step S3, a secure and precise matching channel is established: the hash recalculation of the segmented words is completed within the trusted execution environment to generate real-time hash fingerprints, which are then compared with the encrypted hash index in the encrypted index library. The entire comparison process involves no plaintext word parsing or plaintext loading. If the hash fingerprints are completely consistent, it is determined to be a precise match. The standard security level of the word is directly decrypted and read, and the highest confidence level with a weight coefficient of 1.0 is assigned to generate rigid word-level sensitivity. Step S3 also establishes a semantic fuzzy matching channel: for word segmentation words that are not precisely matched by hash fingerprints, a context semantic awareness matching mechanism is enabled; dynamic context embedding vectors of the current word segmentation words in the context of this sentence are extracted based on a pre-trained language model to eliminate the ambiguity of static word vectors; the dynamic context embedding vectors are batch-wise semantically similar to the set of encrypted sensitive word embedding vectors pre-stored in the optimized word segmentation dictionary for classified fields, and the associated words with the highest similarity are selected; after completing the vector similarity calculation, the Youden exponent maximization criterion is used to traverse and optimize within the industry validation set to determine the optimal similarity threshold to balance precision and recall; when the semantic similarity of the candidate word is greater than the optimal similarity threshold, it is determined to be a semantic association hit, and then combined with the security level and semantic similarity score of the matched word for weighted calculation to generate flexible word-level sensitivity; After obtaining rigid and flexible word-level sensitivity, confidence fusion is completed using differentiated weights, and finally a quantifiable, sortable, and traceable word-level sensitivity matrix is ​​output, which is then used in step S4 for sentence-level adversarial sensitivity analysis.

5. The method as described in claim 1, characterized in that, In step S4, firstly, considering the characteristics of confidential industrial documents, a customized industry-specific prompt template is created. The sentences parsed in step S2 are embedded into fixed prompt phrases to guide the pre-trained language model to focus on sensitive semantic elements within the sentence and filter out irrelevant interfering text. The encapsulated prompt sentences are then input into the finely tuned pre-trained language model, where the multi-layer Transformer structure of the pre-trained language model completes deep semantic feature extraction. During the model training phase, a joint optimization mechanism of adversarial perturbation enhancement and self-supervised contrastive learning is introduced: after the word embedding layer output and before Transformer encoding, a normalization perturbation is applied to the embedding tensor along the loss gradient direction to generate adversarial enhancement samples without destroying the original business semantics of the sentence, simulating various evasion-style tampering behaviors. A joint loss function consisting of cross-entropy classification loss and self-supervised contrastive loss is constructed, where cross-entropy loss constrains the convergence effect of the security level classification; the self-supervised contrastive loss sets the original sentence and its corresponding adversarial enhancement sample as positive pairs, and sentence samples with a security level difference of two or more levels within the same batch as negative pairs, thus widening the semantic feature gap between sentences of different security levels. During forward inference, the pre-trained language model outputs a density probability distribution of 1 to 5 levels. The level corresponding to the highest probability is selected as the sensitivity level of the current sentence. The output sentence sensitivity set is then supplied to step S5 for paragraph-level density adaptive aggregation.

6. The method as described in claim 1, characterized in that, In step S5, firstly, all sentences under a single paragraph are traversed, and medium-to-high sensitivity sentences with a sensitivity level ≥ 3 are selected. The ratio of such sentences to the total number of sentences in the paragraph is calculated as the sensitivity density of this paragraph. At the same time, the maximum value of the sensitivity of all sentences in this paragraph is extracted as the basic sensitivity benchmark value of the paragraph. Then, a continuously differentiable, smooth and bounded hyperbolic tangent density compensation function is introduced to perform dynamic gain compensation on the paragraph-sensitive clustering features, generating density level results for all paragraphs.

7. The method as described in claim 6, characterized in that, This hyperbolic tangent density compensation function incorporates three types of hyperparameters: compensation intensity coefficient, kurtosis coefficient, and density critical threshold. During inference, it automatically loads pre-trained hyperparameter combinations based on the current document's industry tags. It also supports online fine-tuning, collecting missed / falsely labeled samples after batch document inference to slightly correct hyperparameters without retraining the backbone model, and adapting to cross-domain documents without manual parameter tuning.

8. The method as described in claim 1, characterized in that, In step S6, firstly, the density level distribution of all paragraphs in the whole text is statistically analyzed, a histogram of paragraph density level distribution is constructed, the proportion of each density level paragraph is calculated, and the document structure statistical features are formed; then, the document is input into a pre-trained language model to extract the global semantic representation vector of the document level; the density level prototype vector is initialized by the semantic mean of the same level documents in the preset training set. The cosine similarity between the global semantic representation vector of the document hierarchy and the prototype vector of each security level is calculated to obtain the semantic fit score between the document and each security level. The two types of features are fused by weighting the paragraph structure statistical feature weight and the semantic projection similarity weight, and the comprehensive score of the document for each security level is calculated. The highest score is selected as the basic security level of the document.

9. An automatic document confidentiality labeling system based on multi-level semantic aggregation and adversarial sensitivity awareness, characterized in that, The system is used to implement the method as described in any one of claims 1 to 8.

10. The system as described in claim 9, characterized in that, include: Sensitive word library construction and security management module: used to build a classified sensitive word library, implement word hash index construction based on HMAC-SHA256, and independently encrypt and store the security level and semantic attribute blocks; It interfaces with the hardware security module to complete root key generation and session key derivation, and supports automatic dictionary expansion and double-buffered hot reload; Document preprocessing module: used to perform paragraph segmentation, sentence segmentation, word segmentation and part-of-speech tagging on the input document to be coded, and generate a four-level nested hierarchical topology; Word-level dual-channel sensitivity determination module: Deploys both dense-state precise matching and semantic fuzzy matching dual-path, used to complete word hash comparison, context semantic vector similarity calculation, realize dual-channel differentiated weight reset confidence fusion, and output word-level sensitivity matrix; Sentence-level multi-category sensitivity analysis module: It has a built-in pre-trained language model trained by adversarial fine-tuning and self-supervised contrastive learning, which is used to predict the probability distribution of sentence density level through domain prompt templates and output a set of sentence sensitivity. Paragraph-level density adaptive aggregation module: used to calculate paragraph sensitivity density, call the density compensation function to complete dynamic compensation of maximum sentence sensitivity, and aggregate to obtain the final paragraph-level sensitivity; Document-level global security classification and source tracing report module: used to extract the global semantic representation of the document, integrate paragraph statistical features and security classification prototype semantic projection, and determine the full-text security classification by weighting.