A semantic-fidelity-based power environment intelligent text generation watermark embedding and tracing method
Patent Information
- Application Number
- CN202611277479.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-21
- Publication Date
- 2026-10-30
AI Technical Summary
直接调整全部候选词的生成概率可能改变专业实体对应词语的选择结果,使生成文本出现业务语义偏差
1、本发明通过获取操作人员身份信息和终端环境信息生成动态水印密钥,并基于动态水印密钥以及文本生成过程中的上下文信息对候选词表进行动态划分,将水印特征关联至文本生成过程中的词选择行为,使生成文本包含与操作人员身份信息对应的水印特征。
Smart Images

Figure CN123013059A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of power information security and natural language processing technology, specifically to a method for generating watermarks and tracing source-based intelligent text in power contexts based on semantic fidelity. Background Technology
[0002] With the development of artificial intelligence technology, text generation technology based on large language models is gradually being applied to power production business scenarios, such as generating power equipment inspection records, fault analysis reports, and dispatching business texts. Intelligent terminals deployed in field environments such as distribution rooms and substations can generate power business texts by combining on-site operational data, improving the information processing efficiency of power operation and maintenance personnel. However, because power business texts typically contain sensitive information such as equipment operating status, equipment identification information, power grid operating parameters, and dispatching operation content, when these texts are transmitted or stored in text form, they can spread outside their original application environment through copying, forwarding, and other means, making it difficult to determine the source of leaked texts.
[0003] Currently, information protection for generated text mainly employs two types of technologies: explicit watermarking and implicit watermarking. Explicit watermarking typically involves adding specific identifier characters, invisible characters, or text formatting information to the text for marking. However, this type of watermark information is easily lost during text copying, format conversion, and text cleaning operations, making it unsuitable for source tracing in plain text scenarios.
[0004] Implicit text watermarking typically adjusts the selection probability of candidate words during the generation process of a large language model, embedding specific statistical features into the generated text. For example, by pre-dividing the word set and adjusting the generation probability of candidate words belonging to a specified word set, the generated text can possess detectable statistical features. However, existing implicit text watermarking methods are mainly geared towards general text generation scenarios. In the generation of power business text, candidate words contain a large number of specialized entities with definite business meanings, such as electrical parameters, equipment identifiers, switch status descriptions, and dispatch operation instructions. Directly adjusting the generation probability of all candidate words may alter the selection results of words corresponding to specialized entities, leading to business semantic deviations in the generated text.
[0005] Furthermore, existing text watermarking methods typically employ fixed watermarking rules or keys for embedding the watermark. This results in a lack of correlation between the watermark features in the generated text and the specific operator or terminal environment. When multiple people share a smart terminal or generate text under different operating environments, it is difficult to accurately determine the corresponding generating entity based on the leaked text. Additionally, some text watermarking detection methods rely on the original generation model parameters, generation logs, or the complete inference process. However, in actual leak handling, it is usually only possible to obtain the externally disseminated text content, which is insufficient to meet the need for source analysis based on plain text data.
[0006] In addition, smart terminals for power applications are usually deployed in field edge environments, where computing resources are limited compared to cloud servers. Complex text analysis models and large-scale calculation processes increase the computational burden in the text generation process, affecting on-site interactive applications. Summary of the Invention
[0007] This invention aims to solve the above-mentioned technical problems by providing a semantically accurate watermark embedding and source tracing method for intelligent text generation in the power context. Through dynamic watermark key generation, context-adaptive watermark embedding, power semantic protection control, and reverse statistical source tracing mechanism, it realizes semantically accurate watermark embedding and leakage text source tracing in the process of intelligent text generation in the power context.
[0008] The objective of this invention can be achieved through the following technical solutions: A semantically faithful intelligent text generation watermark embedding and source tracing method for power-related applications includes: S1. Obtain the operator's identity information and terminal environment information corresponding to the text generation request received by the power equipment intelligent terminal, and generate a dynamic watermark key based on the operator's identity information and terminal environment information. S2. During the autoregressive text generation process of the power-equipped intelligent terminal based on the text generation request, obtain the context information corresponding to the current generation position, and dynamically divide the candidate word list according to the dynamic watermark key and the context information to obtain the watermarked word set and the non-watermarked word set. S3. Obtain the candidate words corresponding to the current generation position, perform power semantic entity detection on the candidate words, and determine the semantic protection status corresponding to the candidate words based on the detection results; S4. Adjust the generation probability of candidate words according to the semantic protection status. When the semantic protection status of the candidate word is protected, maintain the original generation probability of the candidate word. When the semantic protection status of the candidate word is unprotected, adjust the generation probability of the candidate word according to the watermark word set, and determine the target word corresponding to the current generation position according to the adjusted generation probability. S5. Obtain the power text to be traced, generate the corresponding dynamic watermark key based on the candidate operator's identity information, determine the watermark word set corresponding to the power text to be traced based on the dynamic watermark key, and count the matching relationship between the words in the power text to be traced and the watermark word set. Based on the statistical results, determine the operator corresponding to the power text to be traced.
[0009] Furthermore, step S1 includes: Get the current network standard timestamp Set the key update cycle The discretization time factor is calculated by rounding down. : Read the preset system-level salt value from the security chip. And according to the operator's employee number Terminal network card physical address Micro-spatiotemporal scene coding Discretization time factor and system-level salinity Construct feature aggregation strings : in, This represents a binary concatenation operation; Use the SHA-256 hash algorithm to aggregate the feature strings Perform a hash operation to obtain a 256-bit hash value. Truncate the high 64 bits of the 256-bit hash value and map the truncated result to an unsigned long integer to obtain the dynamic watermark key. .
[0010] Furthermore, step S2 includes: Set the sliding window length k, and obtain the word index sequence corresponding to the k consecutive generated word tokens before the current generation position t: Based on the dynamic watermark key Calculate the context random number corresponding to the current generation position using the word index sequence. : in, It is a non-cryptographic fast hash function; Using context random numbers Initialize the linear congruential generator to generate a random permutation index sequence P with a length equal to the candidate vocabulary size |V|; Set the watermark word set ratio coefficient ,in Randomly arrange the first few elements of the index sequence P. The words corresponding to the first index are determined as the watermarked word set, and the words corresponding to the remaining indexes are determined as the non-watermarked word set.
[0011] Furthermore, step S3 includes: A power domain dictionary tree is preloaded in the storage area of the power-equipped intelligent terminal. The power domain dictionary tree includes power equipment ledger information, standard operating terminology information, and safety procedure keyword information. Get the currently generated text suffix and the candidate words corresponding to the current generation position, and combine the currently generated text suffix and the candidate words to obtain the text sequence to be matched; The Aho-Corasick automaton is used to perform multi-pattern matching on the text sequence to be matched. When the text sequence to be matched matches a leaf node in the power domain dictionary tree, the candidate word is identified as a power semantic protection entity, and a semantic locking signal is generated; When the text sequence to be matched does not match a leaf node in the power domain dictionary tree, the candidate words are input into the entity recognition model for contextual semantic detection.
[0012] Furthermore, step S3 also includes: Obtain the context sequence corresponding to the candidate words; Input the context sequence into a lightweight Transformer encoder that has undergone pruned quantization to obtain the entity category probability distribution corresponding to the candidate words; The entity category probability distribution includes probability values corresponding to voltage and current entity categories, equipment identification entity categories, and operating status entity categories. When the probability value corresponding to any entity category in the entity category probability distribution is greater than the preset confidence threshold, the candidate word is determined as a power semantic protection entity and a semantic locking signal is generated. The semantic protection status of candidate words is determined based on the entity category corresponding to the power semantic protection entity.
[0013] Furthermore, step S4 includes: Obtain the entity category corresponding to the candidate word, and determine the corresponding probability adjustment strategy based on the entity category; When the candidate word belongs to a numerical entity, the watermark bias parameter is set to zero and the corresponding masking vector is generated; The generation probability of non-numerical candidate words is masked according to the masking vector, so that the sampling range of candidate words is limited to the set of candidate words corresponding to numerical entities. When a candidate word belongs to a state action instruction entity, obtain the set of mutually exclusive state words corresponding to the state action instruction entity; Watermark bias is prohibited on candidate words with state inversion relationships based on the set of mutually exclusive state words; When there are semantically similar words in the original candidate word set, and all semantically similar words belong to the watermark word set, the watermark bias parameter is added to the generation probability corresponding to the semantically similar words. When a candidate word belongs to a non-keyword entity, obtain the original generation probability distribution corresponding to the candidate word, and calculate the information entropy based on the original generation probability distribution: Calculate the adaptive bias parameters based on information entropy: in, Based on the basic bias parameters, For enhancement coefficient; The generation probability of candidate words is adjusted based on adaptive bias parameters.
[0014] Furthermore, step S5 includes: Obtain the identity information of the candidate operators corresponding to the power text to be traced; Based on the candidate operator's identity information, the corresponding terminal environment information, and the text generation time information, a candidate dynamic watermark key is generated. Based on the candidate dynamic watermark keys and the context token sequence in the power text to be traced, determine the set of candidate watermark words corresponding to each generation position in the power text to be traced. The effective watermark carrier tokens in the power source text to be traced are matched according to the candidate watermark word set. The number of effective watermark carrier tokens belonging to the candidate watermark word set is counted to obtain the number of watermark matches.
[0015] Furthermore, step S5 also includes: Obtain the tokens from the power text sequence to be traced, and remove punctuation tokens and tokens corresponding to power semantic protection entities to obtain the valid watermark carrier tokens. Count the number of valid watermark carrier tokens to obtain the total number of valid watermark carrier tokens. ; The number of valid watermark carrier tokens that belong to the candidate watermark word set is counted to obtain the watermark matching count. ; Based on the total number of valid watermark carrier tokens Number of watermark matches And the proportional parameters corresponding to the watermark word set Calculate the Z-score test result: The Z-score statistical test value is compared with the preset judgment threshold. When the Z-score statistical test value is greater than the preset judgment threshold, the candidate operator's identity information is determined as the operator corresponding to the power text to be traced.
[0016] Furthermore, step S5 also includes: Obtain the set of unmatched candidate watermark words in the power source text to be traced and analyze the token to be analyzed; Obtain the semantically related tokens corresponding to the tokens to be analyzed based on the preset thesaurus mapping table; When the token to be analyzed does not belong to the candidate watermark word set, but the semantically related token belongs to the candidate watermark word set, the watermark matching weight is assigned to the token to be analyzed according to the preset weight parameters, and the watermark matching quantity is updated. Obtain the semantic vector corresponding to the Token to be analyzed, and obtain the word semantic vector corresponding to each candidate watermark word in the candidate watermark word set; Calculate the cosine similarity between the semantic vector of the token to be analyzed and the semantic vector of the candidate watermark words; When the cosine similarity is greater than the preset similarity threshold, the token to be analyzed is determined as the semantic matching token, and the number of watermark matches is updated according to the semantic matching token. The Z-score statistic is recalculated based on the updated number of watermark matches.
[0017] Furthermore, it also includes: When performing the text generation reasoning process on the intelligent terminal, the hash calculation process, random number generation process, and watermark word set construction process corresponding to the dynamic watermark key are fused by operators to generate a fusion calculation operator. The fusion computation operator is invoked to perform the calculation of the context random parameters corresponding to the dynamic watermark key, the generation of random permutation indexes, and the partitioning of the watermark word set. During the process of the graphics processor performing word embedding matrix calculation for the current generation position, the central processing unit thread pre-calculates the random number parameters and watermark word set for the next generation position based on the context information corresponding to the next generation position. Store the random number parameter corresponding to the next generation position and the watermark word set into the cache area; When generating candidate words for the next generation position, the probability of candidate words is adjusted by calling the random number parameter in the cache area and the watermark word set.
[0018] Compared with the prior art, the present invention has the following beneficial effects: 1. This invention generates a dynamic watermark key by acquiring operator identity information and terminal environment information, and dynamically divides the candidate word list based on the dynamic watermark key and context information in the text generation process, associating the watermark features with the word selection behavior in the text generation process, so that the generated text contains watermark features corresponding to the operator identity information.
[0019] 2. This invention performs power semantic entity detection on candidate words and controls the candidate word generation probability adjustment process according to the semantic protection status corresponding to the candidate words. When the candidate word belongs to the power semantic protection entity, the original probability distribution is maintained. When the candidate word does not belong to the power semantic protection entity, the generation probability is adjusted based on the watermark word set, so that the watermark embedding process is applicable to power business text generation scenarios that include electrical analog quantities, equipment identification, switch status and scheduling business instructions.
[0020] 3. This invention constructs an electric power semantic entity detection process that includes a dictionary tree and entity recognition model in the electric power field, identifies the electric power semantic entities corresponding to candidate words, and determines the semantic protection status based on the identification results, so that the watermark embedding process can perform differentiated processing according to different text content.
[0021] 4. This invention regenerates candidate dynamic watermark keys based on the identity information of candidate operators, determines the set of watermark words corresponding to the power text to be traced based on the candidate dynamic watermark keys, and further calculates a statistical evaluation value based on the number of watermark matches and the number of valid statistical words to determine the corresponding operator from the power text to be traced.
[0022] 5. This invention obtains the unmatched watermark word set in the power text to be traced and updates the matching results based on the similarity between the semantic vector corresponding to the word to be analyzed and the semantic vector corresponding to the word in the watermark word set, so that the power text to be traced can still be analyzed for watermark features even when the words change.
[0023] 6. This invention pre-generates a set of watermarked words for the next generation position based on the dynamic watermark key and the context information for the next generation position during the word generation process at the current generation position, and stores the watermarked word set in the cache area, so that the watermarked word set generation process and the text generation process cooperate with each other. Attached Figure Description
[0024] Figure 1 This is an overall flowchart of the method provided in the embodiments of the present invention; Figure 2 A schematic diagram of the logic for generating dynamic private seed keys; Figure 3 This is a schematic diagram illustrating the semantic security lock determination and Logits intervention principle based on hybrid probes. Figure 4 This is a flowchart of the blind extraction and source tracing process based on the inverse Z-score statistical test. Detailed Implementation
[0025] The present invention will now be described in detail with reference to the accompanying drawings and specific embodiments. These embodiments are based on the technical solution of the present invention and provide detailed implementation methods and specific operating procedures. However, the scope of protection of the present invention is not limited to the following embodiments.
[0026] like Figures 1 to 4 The method for generating, embedding, and tracing watermarks in power-related contexts based on semantic fidelity includes: S1. Obtain the operator's identity information and terminal environment information corresponding to the text generation request received by the power equipment intelligent terminal. Generate a dynamic watermark key based on the operator's identity information and terminal environment information. By integrating the operator's identity information, terminal environment information, and time window information to generate a dynamic watermark key, different watermark generation parameters are generated for different operators, different terminal environments, and different time windows. This provides a key basis for the dynamic division of the watermark word set and avoids watermark pattern duplication caused by using fixed watermark rules. Generate a dynamic seed key based on the operator ID, micro-spatiotemporal scene encoding, and discretized time window to establish a relationship between the watermark pattern and the operator's identity and operating environment.
[0027] Furthermore, step S1 includes: Get the current network standard timestamp Set the key update cycle The discretization time factor is calculated by rounding down. : By periodically discretizing continuous time information, dynamic time factors are introduced into the key generation process, thus establishing a correlation between the key generation process and the current time window.
[0028] Read the preset system-level salt value from the security chip. And according to the operator's employee number Used to associate the text generation subject and the terminal network card physical address. Used for associating text generation terminals and micro-spatiotemporal scene encoding Used for associated text generation terminals and discretization time factors Used to associate key generation time windows and system-level salt values. Construct feature aggregation strings : in, This represents a binary concatenation operation. By incorporating the system-level salt value from the security chip into feature aggregation, the generated key not only depends on the operator's identity and operating environment information but also incorporates preset parameters within the terminal, avoiding the direct derivation of the watermark key based solely on publicly available identity information. Operator identity information, terminal device information, spatial environment information, and time information are fused to form a multi-dimensional feature input for dynamic key generation.
[0029] Use the SHA-256 hash algorithm to aggregate the feature strings Perform a hash operation to obtain a 256-bit hash value. Truncate the high 64 bits of the 256-bit hash value and map the truncated result to an unsigned long integer to obtain the dynamic watermark key. Through hash digest processing, a definite mapping relationship is established between the input features and the output key, and a dynamic watermark key suitable for contextual random computation is obtained by truncating the data to a fixed length.
[0030] S2. During the autoregressive text generation process at the power-enabled intelligent terminal based on the text generation request, the context information corresponding to the current generation position is obtained. The candidate word list is dynamically divided according to the dynamic watermark key and the context information to obtain a watermarked word set and a non-watermarked word set. The dynamic watermark key and the current generation context are used to jointly determine the word set division relationship corresponding to the current generation position, so that the watermarked word set corresponding to each generation position changes with the context. Random parameters are generated through context hash calculation, and the candidate word list is randomly segmented according to the random parameters, dividing some words into the watermarked word set and the remaining words into the non-watermarked word set, providing a candidate range for subsequent word probability-based watermark embedding.
[0031] Furthermore, step S2 includes: Set the sliding window length k, and obtain the word index sequence corresponding to the k consecutive generated word tokens before the current generation position t: By using a sliding window to obtain the historical token index within a local context, different watermark generation parameters are applied to different text positions due to different contexts, thus avoiding the use of a fixed set of words that makes the watermark pattern easy to analyze and predict.
[0032] Based on the dynamic watermark key Calculate the context random number corresponding to the current generation position using the word index sequence. : in, It is a non-cryptographic fast hash function. The system uses a combination of operator identity and terminal environment, a context token sequence to associate the current text generation state, and a fast hash function to map these two to a fixed-length random parameter. This allows the same operator to generate different watermarks for different text content and at different generation locations.
[0033] Using context random numbers Initialize a linear congruential generator to generate a randomized index sequence P with a length equal to the candidate word list size |V|. Then, use the linear congruential generator to generate a randomized sequence based on the random parameters corresponding to the current generation position, allowing the word index order in the candidate word list to change according to the dynamic watermark key and context. Compared to a fixed word list partitioning method, this makes the watermark word set no longer fixed.
[0034] Set the watermark word set ratio coefficient ,in Randomly arrange the first few elements of the index sequence P. The words corresponding to the first index are determined as the watermarked word set, and the words corresponding to the remaining indices are determined as the non-watermarked word set. Based on a preset ratio, the watermarked word set and the non-watermarked word set corresponding to the current generation position are determined from a randomly arranged candidate word list, providing a basis for subsequent Logits bias adjustments. Words in the watermarked word set are used as watermark embedding candidates; words in the non-watermarked word set are used as non-watermarking candidates.
[0035] S3. Obtain candidate words corresponding to the current generation position and perform power semantic entity detection on the candidate words. Determine the semantic protection status corresponding to the candidate words based on the detection results. Perform real-time semantic detection on candidate words during text generation to identify key entities that may affect power business security, and determine whether to allow watermark adjustment based on the detection results. Scan the current candidate words using a hybrid probe that combines rule matching and model inference. When a candidate word belongs to a power rigid protection entity, generate a semantic lock status.
[0036] Furthermore, step S3 includes: A power domain dictionary tree is preloaded in the storage area of the power-enabled intelligent terminal. The power domain dictionary tree includes power equipment ledger information, standard operating terminology information, and safety procedure keyword information. A priori knowledge base for power business scenarios is constructed, and keywords with fixed business meanings in the power production process are pre-stored. Obtain the currently generated text suffix and the candidate words corresponding to the current generation position. Combine the currently generated text suffix with the candidate words to obtain the text sequence to be matched. Since detecting only a single candidate word may not be able to determine the complete business meaning, by combining the previously generated text suffix, it is possible to identify power professional entities composed of tokens.
[0037] The Aho-Corasick automaton is used for multi-pattern matching of the text sequence to be matched; it is used for the first layer of deterministic filtering, and fast rule retrieval is performed on the text sequence corresponding to candidate words to determine whether they exist in the power industry dictionary tree. The Aho-Corasick automaton is also used to simultaneously match multiple power industry keywords, enabling rapid detection of a large number of equipment names, operating terms, and safety procedure keywords.
[0038] When the text sequence to be matched matches a leaf node in the power domain dictionary tree, the candidate word is identified as a power semantic protection entity and a semantic locking signal is generated; when the candidate word hits a leaf node in the dictionary tree, it indicates that the candidate word belongs to information with clear power business meaning. At this time, a semantic locking signal is generated to trigger subsequent watermark freezing processing.
[0039] When the text sequence to be matched does not match a leaf node in the power domain dictionary tree, candidate words are input into the entity recognition model for contextual semantic detection. For implicit power entities that cannot be identified by fixed rules, contextual semantic information is used to further determine whether the candidate words belong to the protected object. The rule dictionary is mainly applicable to explicit terms, while some power entities may depend on the context to be determined, such as: abbreviations, contextually omitted expressions, and non-standard descriptions.
[0040] Furthermore, step S3 also includes: Obtain the context sequence corresponding to the candidate words; provide semantic input for entity category prediction, enabling the model to judge the business meaning of the candidate words by combining the context before and after them.
[0041] The context sequence is input into a lightweight Transformer encoder that has undergone pruned quantization to obtain the entity category probability distribution corresponding to the candidate words. The contextual semantic representation is then used to classify and determine the candidate words, identifying power protection entities that cannot be covered by the rule base. The lightweight Transformer encoder with pruned quantization is suitable for deployment in intelligent power terminal environments.
[0042] The entity category probability distribution includes probability values corresponding to voltage and current entity categories, equipment identification entity categories, and operating status entity categories. When the probability value corresponding to any entity category in the entity category probability distribution is greater than a preset confidence threshold, the candidate word is identified as a power semantic protection entity, and a semantic locking signal is generated. Whether the candidate word belongs to the scope of rigid power protection is determined by a probability judgment method. When the model prediction result meets the confidence condition, the candidate word is marked as a protection entity, and the semantic locking mechanism is triggered.
[0043] The semantic protection status of candidate words is determined based on the entity category corresponding to the power semantic protection entity.
[0044] S4. Adjust the generation probability of candidate words according to the semantic protection status. When the semantic protection status of a candidate word is "protected," maintain the original generation probability of the candidate word. When the semantic protection status of a candidate word is "unprotected," adjust the generation probability of the candidate word according to the watermark word set, and determine the target word corresponding to the current generation position based on the adjusted generation probability. Differentiate the watermark embedding process according to the semantic protection status of the candidate word, so that the watermark adjustment only applies to non-critical text areas. When the semantic protection status indicates that the candidate word belongs to a rigid power protection entity, watermark bias adjustment of the candidate word generation probability is prohibited, and the original probability distribution is maintained. When the semantic protection status indicates that the candidate word does not belong to a rigid power protection entity, add Logits bias to the candidate words belonging to the watermark word set to increase the sampling probability of the corresponding candidate words, thereby embedding the watermark feature into non-critical language components.
[0045] Furthermore, step S4 includes: Obtain the entity categories corresponding to candidate words and determine the corresponding probability adjustment strategies based on the entity categories; establish the correlation between candidate word entity categories and watermark embedding strategies, so that different types of candidate words adopt different watermark processing methods. Classify candidate words: numerical entities, state / action command entities, and non-critical entities. Different categories correspond to different probability adjustment rules to avoid using a uniform watermark bias method to process all candidate words.
[0046] When a candidate word is a numerical entity, the watermark bias parameter is set to zero, and a corresponding masking vector is generated. For numerical information in the power business, watermark probability adjustment is prohibited from being applied to numerical tokens. Numerical entities include: voltage parameters, current parameters, power parameters, and temperature parameters.
[0047] The generation probabilities of non-numerical candidate words are masked using masking vectors, limiting the candidate word sampling range to the set of candidate words corresponding to numerical entities. During the generation of numerical entities, the candidate word sampling range is also restricted, ensuring the model selects only from the set of candidate words that match the numerical entity category. Constraints are established for action words in power operation instructions that have opposite business meanings.
[0048] When a candidate word belongs to a status action instruction entity, obtain the set of mutually exclusive status words corresponding to the status action instruction entity; establish constraint relationships for action words with opposite business meanings in power operation instructions. For example: closing, opening, connecting, disconnecting.
[0049] Based on the mutually exclusive state word set, watermark bias is prohibited on candidate words with state inversion relationships; this prevents the watermark embedding process from altering the business meaning of power operation instructions. When a candidate word poses a state inversion risk: the watermark word set bias is not increased; its generation tendency is not adjusted.
[0050] When there are semantically similar words in the original candidate word set, and all semantically similar words belong to the watermark word set, a watermark bias parameter is added to the generation probability of the semantically similar words; without changing the business meaning of the state action, a watermark embedding space is provided for candidate words with equivalent semantics.
[0051] When a candidate word belongs to a non-keyword entity, obtain the original generation probability distribution corresponding to the candidate word, and calculate the information entropy based on the original generation probability distribution: Calculate the adaptive bias parameters based on information entropy: in, Based on the basic bias parameters, To enhance the coefficients, for text regions that do not involve rigid power business information, the original output state of the model is obtained. At the same time, information entropy is used to describe the uncertainty of the distribution of candidate words at the current position, and the appropriate watermark adjustment intensity at the current text position is determined by information entropy.
[0052] The generation probability of candidate words is adjusted based on adaptive bias parameters.
[0053] S5. Obtain the power supply text to be traced. Generate a corresponding dynamic watermark key based on the candidate operator's identity information. Determine the watermark word set corresponding to the power supply text to be traced based on the dynamic watermark key, and statistically analyze the matching relationship between the words in the power supply text to be traced and the watermark word set. Determine the operator corresponding to the power supply text to be traced based on the statistical results. Utilize the reproducible nature of the dynamic watermark rules in the generation stage to perform reverse analysis on the watermark statistical features in the leaked text to determine the text source. Regenerate the corresponding dynamic watermark key based on the candidate operator's identity information, restore the corresponding watermark word set, and count the number of tokens in the leaked text that fall into the corresponding watermark word set. Determine the text source through statistical verification. No original model parameters are required; analysis is performed only based on the leaked text and candidate identity information.
[0054] Furthermore, step S5 includes: Obtain the identity information of the candidate operators corresponding to the power text to be traced; Based on the candidate operator's identity information, the corresponding terminal environment information, and the text generation time information, a candidate dynamic watermark key is generated. Based on the candidate dynamic watermark keys and the context token sequence in the power text to be traced, determine the set of candidate watermark words corresponding to each generation position in the power text to be traced. The effective watermark carrier tokens in the power source text to be traced are matched according to the candidate watermark word set. The number of effective watermark carrier tokens belonging to the candidate watermark word set is counted to obtain the number of watermark matches.
[0055] Furthermore, step S5 also includes: Obtain the tokens from the power text sequence to be traced, and remove punctuation tokens and tokens corresponding to power semantic protection entities to obtain the valid watermark carrier tokens. Count the number of valid watermark carrier tokens to obtain the total number of valid watermark carrier tokens. By removing the aforementioned tokens, the traceability statistics object is made consistent with the actual embedded area of the watermark.
[0056] The number of valid watermark carrier tokens that belong to the candidate watermark word set is counted to obtain the watermark matching count. Restore the candidate watermark word set for the corresponding generation position and determine whether the valid watermark carrier token belongs to the corresponding watermark word set. If it does, count it as part of the watermark matching count. Used for subsequent statistical testing.
[0057] Based on the total number of valid watermark carrier tokens Number of watermark matches And the proportional parameters corresponding to the watermark word set Calculate the Z-score test result: The Z-score is compared with a preset threshold. When the Z-score is greater than the threshold, the candidate operator's identity is identified as the operator corresponding to the power text to be traced. The Z-score is then compared with the threshold to determine if the watermark feature corresponding to the candidate operator exists in the text. If the text was generated by the corresponding operator, then: the number of watermarked words matches the expected distribution, and the Z-score deviates from a random distribution; if the text was not generated by the corresponding operator, then: the number of watermarked words is close to random probability; and the Z-score is low.
[0058] Furthermore, step S5 also includes: Obtain the set of unmatched candidate watermark words in the power source text to be traced and analyze the token to be analyzed; Obtain the semantically related tokens corresponding to the token to be analyzed based on the preset synonym mapping table; when the token to be analyzed does not belong to the candidate watermark word set, but the semantically related tokens do belong to the candidate watermark word set, assign watermark matching weights to the token to be analyzed according to the preset weight parameters, and update the watermark matching count; perform semantic watermark restoration on precise token changes caused by slight text modifications, so as not only to count completely consistent token matching relationships, but also to consider the matching of tokens with semantic relationships.
[0059] Obtain the semantic vector corresponding to the token to be analyzed, and obtain the semantic vector of each candidate watermark word in the candidate watermark word set; represent the meaning of the token through the semantic vector, so that words with different expressions but similar semantics can participate in watermark statistics.
[0060] The cosine similarity between the semantic vector of the token to be analyzed and the semantic vector of the candidate watermark words is calculated. When the cosine similarity is greater than a preset similarity threshold, the token to be analyzed is determined as a semantically matching token, and the number of watermark matches is updated based on the semantically matching token. The Z-score is recalculated based on the updated number of watermark matches. The degree of association between the token to be analyzed and the candidate watermark words is determined based on the semantic spatial distance. In the event of changes such as synonym substitution or semantic rewriting in the text, the watermark statistics are corrected so that the source tracing process can recover the watermark statistical features based on semantic association.
[0061] Specifically, it also includes: When performing text generation reasoning on a real-world intelligent terminal, the hash calculation process, random number generation process, and watermark word set construction process corresponding to the dynamic watermark key are fused together to generate a fusion calculation operator; multiple consecutively executed calculation tasks in the dynamic watermark generation process are combined to form a unified calculation execution unit.
[0062] The fusion computation operator is invoked to perform the calculation of the context random parameters corresponding to the dynamic watermark key, the generation of random permutation indexes, and the partitioning of the watermark word set. The fusion computation operator is used to complete the continuous calculation of the parameters required in the dynamic watermark generation process, providing the watermark word set corresponding to the current generation position for candidate word probability adjustment.
[0063] During the process of the graphics processor performing word embedding matrix calculation for the current generation position, the central processing unit thread pre-calculates the random number parameters and watermark word set for the next generation position based on the context information for the next generation position; and takes advantage of the parallel computing characteristics in the text generation process to pre-execute the watermark parameter calculation process for the next generation position.
[0064] The random number parameter corresponding to the next generation position and the watermark word set are stored in the cache area; when the text generation enters the next position, the corresponding cached data can be read directly.
[0065] When generating candidate words for the next generation position, the random number parameter in the cache area and the watermark word set are used to adjust the probability of the candidate words. The pre-generated watermark parameters are used in the candidate word generation process for the next position, keeping the dynamic watermark embedding process synchronized with the model's autoregressive generation process. This, combined with the CPU and GPU collaborative pre-computation mechanism, allows the dynamic watermark generation process to be embedded into the large language model inference process of the smart terminal in the power environment.
[0066] This embodiment uses the generation of a "10kV power distribution room switching operation ticket" by a handheld power environment intelligent terminal deployed at the power distribution room site as an example to illustrate the semantically faithful power environment intelligent text generation watermark embedding method provided by the present invention.
[0067] When an operator initiates a text generation request through a smart terminal for power equipment, the system generates a dynamic watermark key based on the operator's identity information, terminal environment information, and current time information, and performs dynamic watermark embedding during the autoregressive generation process of the large language model.
[0068] When a text generation request is initiated ( The system kernel performs the following operations: Parameter acquisition includes collecting the following data: Identity Factors : The operator's employee number, for example, "OP_GD_8821".
[0069] Space factor The Bluetooth beacon ID or GPS fence code of the power distribution room currently connected to the terminal, such as "STATION_TH_03".
[0070] Time factor The current UTC timestamp is divided by 3600 (i.e., the key is updated every hour) to prevent the key from being cracked if it remains unchanged for a long time.
[0071] System salt value : A random string stored in the Trusted Execution Environment (TEE).
[0072] Perform hash operations: Calculate the hybrid hash using either the national cryptographic SM3 algorithm or the SHA-256 algorithm: in Indicates bit splicing.
[0073] Key truncation operation: retrieve The first 64 bits are converted into an unsigned long integer and used as the dynamic private seed key for this session. .
[0074] The large model uses an autoregressive approach to generate tokens one by one. Assume that the t-th token is currently being generated. To resist "long-distance dependency" attacks, the preceding order is used. A sequence of TokenIDs for each Token Calculate the random number for the current step. : Here The XXHash64 algorithm is chosen to ensure nanosecond-level response times on embedded devices. Initialize a linear congruential generator (LCG) and index the full vocabulary. Perform Fisher-Yates scrambling.
[0075] Set the proportion of watermark words Among them, the watermarked word set The first 50% of the indexes after scrambling; the set of non-watermarked words These are the last 50% of the indexes after scrambling.
[0076] After the model outputs the raw Logits, the Top-K (e.g., K=20) high-probability tokens are selected as the candidate set. .
[0077] The first layer of detection is performed, based on deterministic matching using a power domain dictionary tree: A dictionary tree of standard power terminology is pre-constructed and stored in memory. Each token in the candidate word set is traversed, and it is determined whether its concatenation with the preceding text matches a leaf node in the power domain dictionary tree. If a match is found, it is marked as `RIGID_ENTITY` (power semantic protection entity), triggering a lock.
[0078] Perform a second layer of detection, based on contextual semantic detection using a lightweight Transformer encoder: For values that cannot be enumerated, a small CNN or DistilBERT model is launched. The input is the current context window. The output is the entity label probability (B-VOL, I-VOL, B-STATE, etc.) for the next word.
[0079] If the probability of the predicted entity being a numerical or state entity is greater than 0.9, it is marked as `RIGID_ENTITY`, triggering a lock, where: If the candidate token is marked as `RIGID_ENTITY` LockSignal(1).
[0080] If the candidate token is a generic word ("of", "is", "suggests") UnlockSignal(0).
[0081] Based on the security lock signal, the original Logits distribution Differentiate your approach: When the security lock is active (Lock=1), semantics are protected, and no modifications are made to Logits based on the green / non-watermarked word set. To prevent errors caused by random sampling, a large boost value can be added to the Logits of rigid entities, forcing the model to select only that entity. For example, if the model originally intended to output "220V", it would force the output of "220V" even if "220V" is in the non-watermarked word set, without ever tampering with the data.
[0082] When the security lock is released (Lock=0), the watermark is injected, and a bias is added to the tokens in the watermark word set. .
[0083] Bias formula: in It is not a fixed value, but a function based on the current predicted entropy E: The higher the entropy (e.g., when generating adjectives), the greater the bias, and the stronger the watermark. When the model hesitates among synonyms such as "suggest," "perform," and "execute," the algorithm strongly guides it to choose the word located in the watermark word set. Temperature sampling is performed based on the modified L', and the output is... .
[0084] This second embodiment details the technical implementation of how the "Source Tracing and Auditing Subsystem" deployed in the internal security management area of China Southern Power Grid accurately locates the source of leakage within milliseconds through fully automated processing after receiving a suspected leaked power business text.
[0085] Suppose the source tracing and auditing subsystem receives a text message intercepted from the internet. The document, approximately 300 characters long, details a fault repair record at a 110kV substation. The tracing process does not rely on the original weight file of the large model; it only requires a shared vocabulary file, hash algorithm configuration, and a list of suspects.
[0086] Assuming the list of suspects to be investigated is The number of participants is K, which could reach several thousand. The system utilizes a GPU cluster for parallel computing.
[0087] Since the exact time when the leaked text was generated is unknown, the system needs to set a search range. Assume the current time is... The leak likely occurred within the past 24 hours. For each user... Generate a set of candidate seed keys : All candidate keys Loaded into GPU memory. CUDA cores are used to compute a random number at each token position in parallel.
[0088] For the t-th position in the text, its preceding Context is fixed. Therefore, the ContextHash value for all positions can be pre-calculated. Construct the state matrix ,in Construct a Boolean matrix. Judgment logic: Use R[k,t] to generate a permutation and check the actual occurrences in the text. Is it located in front? One position. If so, then .
[0089] The dynamic threshold decision logic is as follows: Level 1 threshold ( ): Corresponding to a very small P-value ( ).like If it is determined to be "ironclad evidence", the traceability result will be output directly without manual review.
[0090] Secondary threshold ( ): Corresponding P value .like If the result is determined to be "highly suspected", the system will output a source tracing report with highlighted keywords for manual auditing.
[0091] Level 3 threshold ( ): This is only relevant when the sample size is very small (N<30), indicating "may be relevant".
[0092] In cases where malicious attackers concatenate text fragments generated by different operators, the global Z-score may decrease due to signal dilution. This invention introduces a sliding window mechanism to address this issue.
[0093] Set window length Each Token, Step Size Local Z-score scan: for text This generates a series of subsequence fragments. For each suspect... Calculate its local score within each window w. .draw The Z-score curve varies with text position. If the curve is within the interval... If the value consistently exceeds the threshold of 4.0 in the internal region, while fluctuating around 0 in other regions, then it is determined that: "The text..." The fragment is made by "Leaked".
[0094] The system ultimately outputs a structured report: "Concatenated text detected. Characters 1-120: Source: User_A" Words 121-200: Source unknown (Z<1.5); Words 201-350: Source User_B . To counter attacks where attackers use AI rewriting tools (such as GPT-4) to perform synonym replacements on text, the system introduces a "soft-hit" mechanism. If the current token... The green list was not matched; the system is now querying the synonym vector library. (Search) Find the top 3 synonyms {syn_1, syn_2, syn_3}. Check if these synonyms are on the green list. If a data point is on the green list and has a semantic similarity greater than 0.85, then it will be given... A decayed hit score (e.g., 0.5 points) instead of 0 points.
[0095] Revised formula for total hits: This mechanism allows the source tracing system to maintain a significant Z-score signal even if 30%-40% of the words in the text are modified.
[0096] Perform inverse statistical tests: text preprocessing and payload extraction, for Token segmentation is performed. Using a Trie tree and NER model identical to the one used in the generation process, rigid entities (numerical values, device names) are identified in the text. Rigid entities are removed, retaining only function words, conjunctions, and general descriptive words. Let the total number of remaining valid tokens be N. Assume the suspect list is as follows: For each user :use ID reconstruction seed Recalculate the hash value at each step of text generation to reproduce the green list sequence. .statistics How many valid tokens are there? They actually fell into the corresponding green list. In the middle, it is denoted as .
[0097] Under the null hypothesis that the text is irrelevant to the user, the number of hits in the green list should follow a binomial distribution. Calculate the standard normal distribution statistic: in .
[0098] The decision logic is as follows: like (P-value) If so, then determine Indeed, it is a user generate.
[0099] like If so, the evidence is extremely conclusive.
[0100] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments according to this application. As used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise. Furthermore, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they indicate the presence of features, steps, operations, devices, components, and / or combinations thereof.
[0101] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. This is in conjunction with the validity mask in step S52. Calculate the weighted total number of hits for each candidate key. : Under the null hypothesis (the text is user-independent), the hit count follows a binomial distribution. , expected to be The variance is Calculate the standardized score: It should be understood that the data used in this way can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than those illustrated or described herein.
[0102] The present invention has been further described above with reference to specific embodiments. However, it should be understood that the specific description herein should not be construed as limiting the nature and scope of the present invention. Various modifications made to the above embodiments by those skilled in the art after reading this specification are all within the scope of protection of the present invention.
Claims
1. A semantically faithful method for generating intelligent text for power applications, including watermark embedding and tracing, characterized in that... include: S1. Obtain the operator's identity information and terminal environment information corresponding to the text generation request received by the power equipment intelligent terminal, and generate a dynamic watermark key based on the operator's identity information and terminal environment information; S2. During the process of autoregressive text generation by the power intelligent terminal according to the text generation request, the context information corresponding to the current generation position is obtained, and the candidate word list is dynamically divided according to the dynamic watermark key and the context information to obtain a watermarked word set and a non-watermarked word set. S3. Obtain candidate words corresponding to the current generation position, perform power semantic entity detection on the candidate words, and determine the semantic protection status corresponding to the candidate words based on the detection results; S4. Adjust the generation probability of the candidate word according to the semantic protection status. When the semantic protection status of the candidate word is protected, maintain the original generation probability of the candidate word. When the semantic protection status of the candidate word is unprotected, adjust the generation probability of the candidate word according to the watermark word set, and determine the target word corresponding to the current generation position according to the adjusted generation probability. S5. Obtain the power text to be traced, generate the corresponding dynamic watermark key based on the candidate operator's identity information, determine the watermark word set corresponding to the power text to be traced based on the dynamic watermark key, and count the matching relationship between the words in the power text to be traced and the watermark word set. Based on the statistical results, determine the operator corresponding to the power text to be traced.
2. The method for watermark embedding and tracing watermarks in power-related intelligent text generation based on semantic fidelity according to claim 1, characterized in that, Step S1 includes: Get the current network standard timestamp Set the key update cycle The discretization time factor is calculated by rounding down. : Read the preset system-level salt value from the security chip. And according to the operator's employee number Terminal network card physical address Micro-spatiotemporal scene coding The discretization time factor and the system-level salt value Construct feature aggregation strings : in, This represents a binary concatenation operation; The feature aggregation string is processed using the SHA-256 hash algorithm. Perform a digest operation to obtain a 256-bit hash value. Extract the high 64 bits of the 256-bit hash value and map the extracted result to an unsigned long integer to obtain the dynamic watermark key. .
3. The method for watermark embedding and tracing watermarks in power-related intelligent text generation based on semantic fidelity according to claim 1, characterized in that, Step S2 includes: Set the sliding window length k, and obtain the word index sequence corresponding to the k consecutive generated word tokens before the current generation position t: According to the dynamic watermark key Calculate the context random number corresponding to the current generation position using the word index sequence. : in, It is a non-cryptographic fast hash function; Using the context random number Initialize the linear congruential generator to generate a random permutation index sequence P with a length equal to the candidate vocabulary size |V|; Set the watermark word set ratio coefficient ,in The first element of the randomly permuted index sequence P The words corresponding to the first index are determined as the watermarked word set, and the words corresponding to the remaining indexes are determined as the non-watermarked word set.
4. The method for watermark embedding and tracing watermarks in power-related intelligent text generation based on semantic fidelity according to claim 1, characterized in that, Step S3 includes: A power domain dictionary tree is preloaded in the storage area of the power-equipped intelligent terminal. The power domain dictionary tree includes power equipment ledger information, standard operating terminology information, and safety procedure keyword information. Obtain the currently generated text suffix and the candidate word corresponding to the current generation position, and combine the currently generated text suffix with the candidate word to obtain the text sequence to be matched; The Aho-Corasick automaton was used to perform multi-pattern matching on the text sequence to be matched. When the text sequence to be matched matches a leaf node in the power domain dictionary tree, the candidate word is identified as a power semantic protection entity, and a semantic locking signal is generated; When the text sequence to be matched does not match a leaf node in the power domain dictionary tree, the candidate word is input into the entity recognition model for contextual semantic detection.
5. The method for semantically faithful intelligent text generation, watermark embedding, and tracing in power applications according to claim 4, characterized in that, Step S3 further includes: Obtain the context sequence corresponding to the candidate word; The context sequence is input into a lightweight Transformer encoder that has undergone pruned quantization to obtain the entity category probability distribution corresponding to the candidate word. The entity category probability distribution includes probability values corresponding to voltage and current entity categories, device identification entity categories, and operation status entity categories. When the probability value corresponding to any entity category in the entity category probability distribution is greater than the preset confidence threshold, the candidate word is determined as a power semantic protection entity, and the semantic locking signal is generated. The semantic protection status of the candidate word is determined based on the entity category corresponding to the power semantic protection entity.
6. The method for watermark embedding and tracing watermarks in power-related intelligent text generation based on semantic fidelity according to claim 1, characterized in that, Step S4 includes: Obtain the entity category corresponding to the candidate word, and determine the corresponding probability adjustment strategy based on the entity category; When the candidate word belongs to a numerical entity, the watermark bias parameter is set to zero, and the corresponding masking vector is generated; The generation probability of non-numerical candidate words is masked according to the masking vector, so that the sampling range of candidate words is limited to the set of candidate words corresponding to numerical entities. When the candidate word belongs to a state action instruction entity, obtain the set of mutually exclusive state words corresponding to the state action instruction entity; According to the set of mutually exclusive state words, watermark bias is prohibited from being applied to candidate words with state inversion relationships; When there are semantically similar words in the original candidate word set, and all of the semantically similar words belong to the watermark word set, the watermark bias parameter is added to the generation probability corresponding to the semantically similar words. When the candidate word belongs to a non-keyword entity, obtain the original generation probability distribution corresponding to the candidate word, and calculate the information entropy based on the original generation probability distribution: Calculate the adaptive bias parameters based on the information entropy: in, Based on the basic bias parameters, For enhancement coefficient; The generation probability of the candidate word is adjusted according to the adaptive bias parameter.
7. The method for watermark embedding and tracing watermarks in power-related intelligent text generation based on semantic fidelity according to claim 1, characterized in that, Step S5 includes: Obtain the identity information of the candidate operators corresponding to the power text to be traced; Based on the candidate operator's identity information, the corresponding terminal environment information, and the text generation time information, a candidate dynamic watermark key is generated. Based on the candidate dynamic watermark key and the context token sequence in the power text to be traced, determine the set of candidate watermark words corresponding to each generation position in the power text to be traced; The effective watermark carrier tokens in the power text to be traced are matched according to the candidate watermark word set, and the number of effective watermark carrier tokens belonging to the candidate watermark word set is counted to obtain the watermark matching count.
8. The method for watermark embedding and tracing watermarks in power-related intelligent text generation based on semantic fidelity according to claim 7, characterized in that, Step S5 further includes: The tokens in the power text sequence to be traced are obtained, and punctuation tokens and tokens corresponding to power semantic protection entities are removed to obtain valid watermark carrier tokens. The number of valid watermark carrier tokens is then counted to obtain the total number of valid watermark carrier tokens. ; The number of watermark matches is obtained by counting the number of tokens in the valid watermark carrier tokens that belong to the candidate watermark word set. ; Based on the total number of valid watermark carrier tokens The number of watermark matches and the proportional parameters corresponding to the watermark word set. Calculate the Z-score test result: The Z-score statistical test value is compared with a preset judgment threshold. When the Z-score statistical test value is greater than the preset judgment threshold, the candidate operator's identity information is determined as the operator corresponding to the power text to be traced.
9. The method for watermark embedding and tracing watermarks in power-related intelligent text generation based on semantic fidelity according to claim 8, characterized in that, Step S5 further includes: Obtain the token to be analyzed from the power text to be traced that does not match the set of candidate watermark words; Obtain the semantically related tokens corresponding to the tokens to be analyzed based on a preset synonym mapping table; When the token to be analyzed does not belong to the candidate watermark word set, but the semantically related token belongs to the candidate watermark word set, the watermark matching weight is assigned to the token to be analyzed according to the preset weight parameters, and the watermark matching quantity is updated. Obtain the semantic vector corresponding to the Token to be analyzed, and obtain the word semantic vector corresponding to each candidate watermark word in the candidate watermark word set; Calculate the cosine similarity between the semantic vector corresponding to the token to be analyzed and the word semantic vector corresponding to the candidate watermark word; When the cosine similarity is greater than a preset similarity threshold, the token to be analyzed is determined as a semantic matching token, and the number of watermark matches is updated according to the semantic matching token. The Z-score statistical test is recalculated based on the updated number of watermark matches.
10. The method for watermark embedding and tracing watermarks in power-related intelligent text generation based on semantic fidelity according to claim 1, characterized in that, Also includes: When performing the text generation reasoning process on the intelligent terminal, the hash calculation process, random number generation process, and watermark word set construction process corresponding to the dynamic watermark key are fused by operators to generate a fusion calculation operator. The fusion calculation operator is invoked to perform the calculation of the context random parameters corresponding to the dynamic watermark key, the generation of random permutation indexes, and the partitioning of the watermark word set. During the process of the graphics processor performing word embedding matrix calculation for the current generation position, the central processing unit thread pre-calculates the random number parameters and watermark word set for the next generation position based on the context information corresponding to the next generation position. Store the random number parameter corresponding to the next generation position and the watermark word set into the cache area; When generating candidate words for the next generation position, the random number parameter in the cache area and the watermark word set are used to adjust the probability of the candidate words.
