Large language model watermark embedding method and system based on entropy adaptive adjustment
Through the large language model watermark embedding method based on entropy adaptive adjustment, the entropy value of the token is calculated in real time to dynamically adjust the watermark strength, which solves the problems of low reliability of low-entropy text detection and insufficient robustness to complex attacks, and realizes watermark embedding with high detectability and smoothness, which is suitable for the field of large language model watermark technology.
Patent Information
- Application Number
- CN202511170873.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-21
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2045-08-21
AI Technical Summary
Existing large language model watermarking technology has low detection reliability in low-entropy texts and affects text quality. It is not robust enough in the face of complex attacks and is difficult to provide lasting protection in real environments.
A large language model watermark embedding method based on entropy adaptive adjustment is adopted. The entropy value of the token to be generated is calculated in real time through the entropy analysis module, and the watermark strength control parameter is dynamically generated. The confidence of the watermark signal is quantified in combination with the weight calculation module to realize the adaptive adjustment of the watermark embedding process.
It improves the detection reliability and robustness of watermarks, ensures the readability and fluency of text, maintains its effectiveness in the face of complex attacks, and reduces computational overhead and deployment costs.
Smart Images

Figure CN120705842A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of large language models, and in particular relates to a large language model watermark embedding method based on entropy adaptive adjustment. Background Art
[0002] With the rapid development and widespread application of large language models (LLMs), their popularity in fields such as text generation and content creation has increased significantly. However, this popularity has also brought with it serious abuse issues: malicious actors use large language models to generate false news, spam, or infringing content, making it impossible to reliably identify the source of the text. The root of this problem lies in the fact that traditional text source identification mechanisms rely on external metadata or simple fingerprinting techniques, which are easily tampered with or removed and cannot provide reliable authentication. For example, attackers can use simple text modifications (such as synonym replacement or syntactic reconstruction) to mask the traces of model generation, making the malicious content difficult to trace.
[0003] To address the above-mentioned issues, text watermarking technology has been proposed. It achieves source authentication by embedding hidden features in the generated text. Traditional watermarking methods (such as rule-based keyword replacement or statistical pattern insertion) attempt to implant watermarks without significantly affecting the naturalness of the text. However, these methods have fundamental flaws: due to the limitations of the algorithm's ability to understand semantics, watermark embedding is often achieved by directly modifying, inserting, or replacing text content, making it difficult to balance semantic coherence and text quality. This can lead to semantic deviations or reduced readability in the watermarked text. For example, abrupt word replacements destroy the contextual logic, or inserted noise characters reduce reading fluency. More seriously, traditional watermarking technology lacks deep integration with the large language model generation process, making it less robust in the face of simple attacks such as synonymous substitution and deletion, and its detection accuracy is significantly reduced, limiting its practical application value.
[0004] In recent years, with breakthroughs in the semantics and contextual understanding capabilities of large language models, watermarking technologies based on these models have emerged, enabling more complex and covert embedding strategies. These methods leverage the model's internal mechanisms (such as the logit distribution or probabilistic sampling) to embed watermarks, reducing interference with the text surface and improving both stealth and naturalness. However, the document points out that existing methods still have significant shortcomings: First, in terms of detection accuracy, especially for low-entropy text (i.e., words with high certainty), the watermark signal is easily obscured by the model's inherent high-probability selection, resulting in reduced detection reliability. Second, in terms of robustness, existing watermarking technologies significantly degrade in the face of complex watermark removal attacks (such as synonym substitution, deletion, or adversarial reconstruction), making them difficult to provide sustained protection in real-world environments. For example, high-frequency words in low-entropy text have low entropy values, making existing static watermark strength parameters inadaptable. This can lead to excessive interference with text flow or signal omission, weakening the watermark's practicality. Summary of the Invention
[0005] In view of this, the present invention aims to propose a large language model watermark embedding method based on entropy adaptive adjustment to solve the problem that the existing method has low reliability in low entropy text detection and affects text quality.
[0006] To achieve the above object, the present invention adopts the following technical solutions: A large language model watermark embedding method based on entropy adaptive adjustment, the method comprising: S1. Calculate the entropy value of the token to be generated in real time through the entropy analysis module and dynamically generate the watermark strength control parameter; S2, adaptively adjust the watermark embedding process according to the watermark strength control parameter and output the watermark text; S3. Call the weight calculation module and quantify the confidence of the watermark signal in combination with the watermark strength control parameter.
[0007] Furthermore, a preferred embodiment is proposed, wherein the entropy analysis module includes: The input prompt sequence p1,p2,p3…p k-1 Input the large language model and obtain the unnormalized score distribution V of the kth token to be generated k ; The entropy calculation formula is used to calculate the entropy value E(k) of the kth token, and E(k) is mapped to the watermark strength value range [δ1,δ2], where δ1 is the minimum watermark strength and δ2 is the maximum watermark strength.
[0008] Furthermore, a preferred method is proposed, wherein the entropy calculation formula is:
[0009] Among them, v represents a token in the vocabulary of the current generated token, p v Represents the probability distribution value of v, and τ is a constant.
[0010] Furthermore, a preferred method is proposed, in which the function for mapping the watermark strength value is:
[0011] Where k is the scaling factor and e is a natural constant.
[0012] Furthermore, a preferred method is proposed, wherein the adaptive watermark embedding process includes: When generating the kth token, the key sk and the previous token k-1 are selected as the input of the pseudo-random function F() to generate a random number seed sd; The vocabulary V is divided into subsets V1 and V2 using a random number seed sd, and an adaptively adjusted watermark strength value δ(t) is added to the logit value of each word in V1; Renormalize the logit values of all words to achieve watermark embedding.
[0013] Furthermore, a preferred embodiment is proposed, wherein the weight calculation module includes: is the text to be detected T: t1, t2, t3…t m Each token in generates a weight value W: w1,w2,w3…w m , the weight value W represents the importance of detection; Use the original key sk to generate random numbers for each word in the text to be detected in an embedded manner and complete the vocabulary division, count the number of words from V1, and calculate the z value to quantify the watermark confidence in combination with the entropy value.
[0014] Furthermore, a preferred method is proposed, wherein the z value calculation formula is:
[0015] Among them, |C| V1 represents the number of words from V1, |N| represents the vocabulary size, and W i represents the weight value of the current vocabulary, and γ represents the ratio parameter of vocabulary partition.
[0016] Based on the same inventive concept, the present invention also proposes a large language model watermark embedding system based on entropy adaptive adjustment, the system comprising: The watermark strength control parameter generation module is used to calculate the entropy value of the token to be generated in real time through the entropy analysis module and dynamically generate the watermark strength control parameter; The watermark text acquisition module is used to adaptively adjust the watermark embedding process according to the watermark intensity control parameter and output the watermark text; The quantization module is used to call the weight calculation module and quantify the confidence of the watermark signal in combination with the watermark strength control parameter.
[0017] Based on the same inventive concept, the present invention also proposes a computer device, including a memory and a processor, wherein a computer program is stored in the memory. When the processor runs the computer program stored in the memory, the processor executes the large language model watermark embedding method based on entropy adaptive adjustment as described in any one of the above items.
[0018] Based on the same inventive concept, the present invention also proposes a computer-readable storage medium, which stores a computer program. When the computer program is run by a processor, it executes the steps of the large language model watermark embedding method based on entropy adaptive adjustment as described in any one of the above.
[0019] Compared with the prior art, the present invention has the following beneficial effects: The proposed method uses an entropy analysis module to calculate the entropy of generated tokens in real time, effectively identifying low-entropy regions of the text (i.e., words with high certainty). Dynamically adjusting the watermark embedding strength based on the entropy value prevents the watermark signal from being masked by high-probability words, thereby improving watermark detection reliability. For low-entropy text, the watermark strength can be automatically adjusted to ensure detectability.
[0020] Traditional watermark embedding methods can often disrupt the natural flow of text if the watermark strength is improperly set. This invention, however, avoids the negative impact of excessive watermark strength on text quality by dynamically adjusting the watermark strength control parameter. This makes the watermark embedding process more subtle and natural, ensuring the readability and fluency of the text.
[0021] The method proposed in this paper adaptively adjusts the watermark embedding process, ensuring that the watermark signal maintains high robustness in the face of complex removal attacks (such as synonymous substitution, deletion, or adversarial reconstruction). Dynamic watermark strength adjustment can better adapt to different text content and environmental changes, reducing the risk of removal attacks and improving the effectiveness of watermarks in real-world applications. Entropy analysis methods are used to enable the watermark embedding process to be adaptively adjusted based on the characteristics of different texts. For example, low-entropy and high-entropy texts are processed differently, and the watermark strength is intelligently adjusted based on actual conditions, providing a more flexible and accurate watermark embedding strategy. The weight calculation module is called in conjunction with the watermark strength control parameters to quantify the confidence of the watermark signal. This quantification effectively determines the effectiveness and reliability of the watermark.
[0022] The method proposed in this invention does not rely on model parameter modification or complex post-processing processes. It can be embedded in the existing reasoning process as a lightweight module. It has low computational overhead and deployment cost, and is convenient for large-scale deployment and practical application. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] The accompanying drawings, which constitute part of the present invention, are provided to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are provided to explain the present invention and do not constitute an undue limitation of the present invention. In the accompanying drawings: Figure 1 This is a flow chart of the large language model watermark embedding method based on entropy adaptive adjustment according to the present invention. DETAILED DESCRIPTION
[0024] The following will clearly and completely explain the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. It should be noted that the embodiments of the present invention and the features therein can be combined with each other without conflict, and the embodiments described are only part of the embodiments of the present invention, not all of them.
[0025] Implementation method 1, see Figure 1 The large language model watermark embedding method based on entropy adaptive adjustment described in this embodiment includes: S1. Calculate the entropy value of the token to be generated in real time through the entropy analysis module and dynamically generate the watermark strength control parameter; S2, adaptively adjust the watermark embedding process according to the watermark strength control parameter and output the watermark text; S3. Call the weight calculation module and quantify the confidence of the watermark signal in combination with the watermark strength control parameter.
[0026] The method proposed in this embodiment uses an entropy analysis module to calculate the entropy of the generated tokens in real time, effectively identifying low-entropy regions of the text (i.e., words with high certainty). Dynamically adjusting the watermark embedding strength based on the entropy value prevents the watermark signal from being masked by high-probability words, thereby improving watermark detection reliability. For low-entropy text, the watermark strength can be automatically adjusted to ensure detectability.
[0027] Traditional watermark embedding methods can often disrupt the natural flow of text if the watermark strength is improperly set. This invention, however, avoids the negative impact of excessive watermark strength on text quality by dynamically adjusting the watermark strength control parameter. This makes the watermark embedding process more subtle and natural, ensuring the readability and fluency of the text.
[0028] The method proposed in this embodiment adaptively adjusts the watermark embedding process, ensuring that the watermark signal maintains high robustness in the face of complex removal attacks (such as synonymous substitution, deletion, or adversarial reconstruction). Dynamic watermark strength adjustment can better adapt to different text content and environmental changes, reducing the risk of removal attacks and improving the effectiveness of watermarks in real-world applications. Entropy analysis methods are used to enable the watermark embedding process to be adaptively adjusted based on the characteristics of different texts. For example, low-entropy and high-entropy texts are processed differently, and the watermark strength is intelligently adjusted based on actual conditions, providing a more flexible and accurate watermark embedding strategy. The weight calculation module is called in conjunction with the watermark strength control parameters to quantify the confidence of the watermark signal. This quantification effectively determines the effectiveness and reliability of the watermark.
[0029] Implementation 2: This implementation further limits the large language model watermark embedding method based on entropy adaptive adjustment described in Implementation 1. The entropy analysis module includes: The input prompt sequence p1,p2,p3…p k-1 Input the large language model and obtain the unnormalized score distribution V of the kth token to be generated k ; The entropy calculation formula is used to calculate the entropy value E(k) of the kth token, and E(k) is mapped to the watermark strength value range [δ1,δ2], where δ1 is the minimum watermark strength and δ2 is the maximum watermark strength.
[0030] This implementation maps the entropy value E(k) of the kth token to a watermark strength range [δ1,δ2], dynamically adjusting the watermark strength based on the entropy value. In low-entropy regions (i.e., areas with high certainty), the watermark strength is stronger to ensure that the watermark signal is less likely to be obscured by high-probability words. In high-entropy regions (i.e., areas with a more diverse vocabulary selection), the watermark strength is weaker to avoid affecting the fluency and naturalness of the text. This adjustment mechanism improves the concealment and naturalness of the watermark.
[0031] Input prompt sequence p1,p2,p3…p k-1 This affects the entropy of each generated token, so the watermark strength can be dynamically adjusted based on changes in the context. This context-aware adaptive adjustment method is more flexible than statically setting the watermark strength and can effectively adapt to different types of text.
[0032] In real-world applications, the context of text often changes. By calculating the entropy of each token in real time and adjusting the watermark strength accordingly, we can improve the robustness of watermarking technology, ensuring that the watermark remains robust against complex attacks (such as synonymous substitution or adversarial reconstruction). Especially in low-entropy text, increasing watermark strength can resist attacks and reduce watermark signal loss.
[0033] The strategy of dynamically adjusting the watermark strength effectively avoids the loss of text quality caused by excessive watermark strength. In high-entropy regions, the watermark strength is weaker, minimizing interference with text fluency. In low-entropy regions, the watermark strength is increased, ensuring detectability without excessively interfering with the naturalness of the text. This adjustment ensures a balance between watermark concealment and text quality.
[0034] Implementation method 3: This implementation method further limits the large language model watermark embedding method based on entropy adaptive adjustment described in implementation method 2. The entropy calculation formula is:
[0035] Among them, v represents a token in the vocabulary of the current generated token, p v Represents the probability distribution value of v, and τ is a constant.
[0036] Implementation 4: This implementation further limits the large language model watermark embedding method based on entropy adaptive adjustment described in Implementation 3. The function for mapping the watermark strength value is:
[0037] Where k is the scaling factor and e is a natural constant.
[0038] Implementation 5: This implementation further limits the large language model watermark embedding method based on entropy adaptive adjustment described in Implementation 1. The adaptive adjustment watermark embedding process includes: When generating the kth token, the key sk and the previous token k-1 are selected as the input of the pseudo-random function F() to generate a random number seed sd; The vocabulary V is divided into subsets V1 and V2 using a random number seed sd, and an adaptively adjusted watermark strength value δ(t) is added to the logit value of each word in V1; Renormalize the logit values of all words to achieve watermark embedding.
[0039] This implementation introduces a pseudorandom function F() and uses the previous token and a secret key to generate a random seed sd. This ensures that watermark embedding depends not only on the content of the current token but also on historical information (the previous token). This adaptive mechanism dynamically adjusts the watermark strength δ(t) based on changes during model generation, making watermark embedding more flexible and less susceptible to external interference or tampering.
[0040] By partitioning the vocabulary V into subsets V1 and V2 and adjusting the logit values of only the words in V1, we can effectively reduce the interference of the watermark on the model output and enhance the watermark's stealth. In particular, the adjustments during the generation process are based on the context of token generation, thus avoiding overly prominent watermark embedding and reducing the impact on model performance.
[0041] Using random number seeds and keys for watermark generation ensures good randomness and diversity in the watermark generation process, which enhances the applicability of the watermark to different models or tasks. If the watermark is tampered with, it will become more difficult to identify and extract, further improving the security of the watermark.
[0042] Since the strength of the watermark is adaptively adjusted during the generation of different tokens, the flexibility and complexity of the watermark are increased, so that the subsequent watermark detection process can effectively avoid the predictability or repetitive patterns that are easily exposed by conventional watermark embedding methods while maintaining high accuracy.
[0043] The adaptive adjustment process ensures that the strength of watermark embedding does not excessively interfere with the performance of the generated model, ensures the quality and fluency of the generated text, and avoids the obvious decline in model output quality caused by overly strong watermarks.
[0044] Implementation 6: This implementation further limits the large language model watermark embedding method based on entropy adaptive adjustment described in Implementation 1. The weight calculation module includes: is the text to be detected T: t1, t2, t3…t m Each token in generates a weight value W: w1,w2,w3…w m , the weight value W represents the importance of detection; Use the original key sk to generate random numbers for each word in the text to be detected in an embedded manner and complete the vocabulary division, count the number of words from V1, and calculate the z value to quantify the watermark confidence in combination with the entropy value.
[0045] In this implementation, the weight calculation module generates a weight for each token, meaning that the detection importance of each word in the text can be dynamically adjusted based on its specific position or context. This adaptive mechanism ensures greater flexibility and precision in the watermark embedding process, effectively improving the robustness and detectability of the watermark.
[0046] Entropy is used to quantify the confidence of the watermark, which can be adjusted according to the complexity or information density of the text content. The higher the entropy value of the text, the greater the uncertainty of the information, so the watermark embedding and detection will be more refined, thereby improving the concealment and accuracy of the watermark in different text scenarios. The use of the original key sk combined with random numbers to generate the vocabulary table partition during the embedding process increases the unpredictability and security of the watermark embedding. This method effectively avoids the risk of the watermark being easily cracked or forged, and improves the protection capabilities of the entire system. By counting the number of words from V1 and combining it with the entropy value for calculation, the "importance" of each word and the "visibility" of the watermark can be more accurately assessed, which not only improves the accuracy of detection, but also makes the watermark embedding effect more balanced and natural.
[0047] By combining random number generation, entropy calculation, and weight adjustment, this method makes the watermark highly resistant to interference. In practical applications, even if the text is edited or partially modified, the watermark can still be detected with high accuracy, enhancing the long-term effectiveness of the watermark.
[0048] Implementation 7: This implementation further limits the large language model watermark embedding method based on entropy adaptive adjustment described in Implementation 6. The z value calculation formula is:
[0049] Among them, |C| V1 represents the number of words from V1, |N| represents the vocabulary size, and W i represents the weight value of the current vocabulary, and γ represents the ratio parameter of vocabulary partition.
[0050] Embodiment 8: The large language model watermark embedding system based on entropy adaptive adjustment described in this embodiment includes: The watermark strength control parameter generation module is used to calculate the entropy value of the token to be generated in real time through the entropy analysis module and dynamically generate the watermark strength control parameter; The watermark text acquisition module is used to adaptively adjust the watermark embedding process according to the watermark intensity control parameter and output the watermark text; The quantization module is used to call the weight calculation module and quantify the confidence of the watermark signal in combination with the watermark strength control parameter.
[0051] Implementation method 9. A computer device described in this implementation method includes a memory and a processor, wherein a computer program is stored in the memory. When the processor runs the computer program stored in the memory, the processor executes the large language model watermark embedding method based on entropy adaptive adjustment as described in any one of implementation methods 1 to 7.
[0052] Implementation method ten: A computer-readable storage medium described in this implementation method stores a computer program, and when the computer program is executed by a processor, the steps of the large language model watermark embedding method based on entropy adaptive adjustment as described in any one of implementation methods one to seven are executed.
[0053] Implementation 11: This implementation provides a specific example of the large language model watermark embedding method based on entropy adaptive adjustment described in Implementation 1, and is also used to explain Implementations 2 to 7. Specifically: A large language model watermark embedding method based on entropy adaptive adjustment includes: S1. Calculate the entropy value of the token to be generated in real time through the entropy analysis module and dynamically generate the watermark strength control parameter; S2, adaptively adjust the watermark embedding process according to the intensity control parameter, and output the watermark text with high detectability and high fluency; S3. Call the weight calculation module and quantify the confidence of the watermark signal in combination with the entropy control strength parameter.
[0054] The entropy analysis module calculates the watermark strength control parameter using the entropy value calculation formula and the watermark strength function; secondly, this parameter is used to dynamically add a bias, which embeds the watermark by changing the token selection of the large language model; the weight calculation module generates a confidence weight for each token based on the entropy control strength parameter, and quantifies the reliability of the watermark's existence through weighted aggregation.
[0055] Specifically, the entropy analysis module includes: Enter the prompt sequence prompt: p1,p2,p3…p k-1 Input into the large language model, the large language model generates an unnormalized score distribution V about the next token: l1, l2, l3…l N .
[0056] In order to make the generated watermark text have the characteristics of high detectability and low text quality loss, the entropy analysis module adaptively adjusts the watermark intensity parameter in real time during the watermark text generation process.
[0057] In the kth step of watermark text generation: according to the V output by the large language model k, the entropy analysis module uses the entropy calculation formula E(t) to calculate the entropy value E(k) of token k; where V k represents the unnormalized score distribution of the kth token to be generated, and E(k) represents the degree of certainty of the kth token. The watermark strength function is then used to map E(k) to a watermark strength value range: [δ1,δ2], where δ1 and δ2 represent the minimum and maximum values of the watermark strength parameter, respectively.
[0058] Specifically, the entropy calculation formula includes:
[0059] Among them, v represents a token in the vocabulary of the current generated token, pv represents the probability distribution value of v, and τ is a constant.
[0060] Specifically, the watermark strength function includes:
[0061] Among them, δ1 and δ2 represent the minimum and maximum values of the watermark strength parameter respectively, and k is the scaling factor.
[0062] Specifically, the adaptive adjustment of the watermark embedding process to generate a watermark text with high detectability and high fluency includes: Enter the prompt sequence prompt: p1,p2,p3…p k-1 Input into the large language model, after the calculation result of the entropy analysis module, the original output of the large language model is adjusted to the text with watermark Text: t1, t2, t3…t m .
[0063] Before each token of the watermark text is generated, the watermark strength parameter calculated by the entropy analysis module is called in real time to adjust the output of the large language model. When generating the kth token, the key sk and the previously generated token k-1 are selected as the input of the pseudo-random function F(), and then a random number seed sd is generated using this pseudo-random function. The random number seed is used to add the vocabulary V of the large language model to the sd. N The vocabulary is divided into two small vocabularies V1 and V2, and the adaptively adjusted watermark strength value δ(t) is added to the logit value of each word in V1. The logit of all words is normalized again to increase the probability of words in V1 being selected, thereby realizing watermark embedding.
[0064] Specifically, the adaptive adjustment of the watermark embedding process to generate a watermark text with high detectability and high fluency includes: To ensure high detectability: A higher watermark strength parameter for a token indicates a higher entropy value and higher uncertainty. Therefore, the adaptive strategy will maximize the guarantee that the token output by the large language model comes from the small vocabulary V1. Conversely, a lower watermark strength parameter for a token indicates a lower entropy value and higher certainty. Therefore, the adaptive strategy will minimize the impact on the selection of the large language model. To ensure high fluency: For tokens with higher uncertainty, the adaptive strategy will minimize the output requirements of the large language model within a certain range to ensure the fluency of the watermarked text. For tokens with higher certainty, the adaptive strategy will minimize the impact on the output of the large language model to ensure the fluency of the watermarked text.
[0065] Specifically, the weight calculation module includes: For a given text to be detected T: t1, t2, t3…t m , the weight calculation module generates a weight value W for each word in T: w1,w2,w3…w m , represents the importance of each word in the detection process.
[0066] In order to ensure high confidence in the watermark detection effect, the detection results are quantitatively described. Using the original key sk, an embedding method is used to generate random numbers for each word in the text to be detected and complete the vocabulary division. Each round needs to complete the following: (1) determine whether the current word comes from the small vocabulary V1; (2) calculate the entropy value when the current word is generated; based on the entropy value of the current word, the forward entropy value is a word from the small vocabulary V1, and the word is divided into weights. Then, using the statistical number of words and the weight list, the current z value is calculated according to the z value calculation formula; when the current z value is greater than the set threshold, it means that the current text is embedded with a watermark.
[0067] Specifically, the z-value calculation formula includes:
[0068] Among them, |C| V1 represents the number of words from V1, |N| represents the vocabulary size, and W i represents the weight value of the current vocabulary, and γ represents the ratio parameter of vocabulary partition.
[0069] Those skilled in the art will appreciate that embodiments of the present disclosure may be provided as methods, systems, or computer program products. Thus, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROMs, optical storage, etc.) containing computer-usable program code.
[0070] The present disclosure is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present disclosure. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including the instruction device, which implements the function specified in the process. Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes. These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes. Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure and are not intended to limit its scope of protection. Although the present disclosure has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that after reading the present disclosure, those skilled in the art can still make various changes, modifications or equivalent substitutions to the specific implementation methods of the invention, but these changes, modifications or equivalent substitutions are all within the scope of protection of the disclosed claims.
Claims
1. A large language model watermark embedding method based on entropy adaptive adjustment, characterized in that: The method comprises: S1. Calculate the entropy value of the token to be generated in real time through the entropy analysis module and dynamically generate the watermark strength control parameter; S2, adaptively adjust the watermark embedding process according to the watermark strength control parameter and output the watermark text; S3. Call the weight calculation module and quantify the confidence of the watermark signal in combination with the watermark strength control parameter.
2. The large language model watermark embedding method based on entropy adaptive adjustment according to claim 1 is characterized in that: The entropy analysis module includes: The input prompt sequence p1,p2,p3…p k-1 Input the large language model and obtain the unnormalized score distribution V of the kth token to be generated k ; The entropy calculation formula is used to calculate the entropy value E(k) of the kth token, and E(k) is mapped to the watermark strength value range [δ1,δ2], where δ1 is the minimum watermark strength and δ2 is the maximum watermark strength.
3. The large language model watermark embedding method based on entropy adaptive adjustment according to claim 2 is characterized in that: The entropy calculation formula is: Among them, v represents a token in the vocabulary of the current generated token, p v Represents the probability distribution value of v, and τ is a constant.
4. The large language model watermark embedding method based on entropy adaptive adjustment according to claim 3 is characterized in that: The function of mapping the watermark strength value is: Where k is the scaling factor and e is a natural constant.
5. The large language model watermark embedding method based on entropy adaptive adjustment according to claim 1 is characterized in that: The adaptive watermark embedding process includes: When generating the kth token, the key sk and the previous token k-1 are selected as the input of the pseudo-random function F() to generate a random number seed sd; The vocabulary V is divided into subsets V1 and V2 using a random number seed sd, and an adaptively adjusted watermark strength value δ(t) is added to the logit value of each word in V1; Renormalize the logit values of all words to achieve watermark embedding.
6. The large language model watermark embedding method based on entropy adaptive adjustment according to claim 1 is characterized in that: The weight calculation module includes: is the text to be detected T: t1, t2, t3…t m Each token in generates a weight value W: w1,w2,w3…w m , the weight value W represents the importance of detection; Use the original key sk to generate random numbers for each word in the text to be detected in an embedded manner and complete the vocabulary division, count the number of words from V1, and calculate the z value to quantify the watermark confidence in combination with the entropy value.
7. The large language model watermark embedding method based on entropy adaptive adjustment according to claim 6 is characterized in that: The z value calculation formula is: Among them, |C| V1 represents the number of words from V1, |N| represents the vocabulary size, and W i represents the weight value of the current vocabulary, and γ represents the ratio parameter of vocabulary partition.
8. A large language model watermark embedding system based on entropy adaptive adjustment, characterized by: The system comprises: The watermark strength control parameter generation module is used to calculate the entropy value of the token to be generated in real time through the entropy analysis module and dynamically generate the watermark strength control parameter; The watermark text acquisition module is used to adaptively adjust the watermark embedding process according to the watermark intensity control parameter and output the watermark text; The quantization module is used to call the weight calculation module and quantify the confidence of the watermark signal in combination with the watermark strength control parameter.
9. A computer device, characterized in that: The invention comprises a memory and a processor, wherein a computer program is stored in the memory. When the processor runs the computer program stored in the memory, the processor executes the large language model watermark embedding method based on entropy adaptive adjustment according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, executes the steps of the large language model watermark embedding method based on entropy adaptive adjustment according to any one of claims 1 to 7.
Citation Information
Patent Citations
Adaptive image watermark embedding method and system and extraction method and system
CN111062853A
Digital watermark model training method, ceramic watermark image manufacturing method and ceramic
CN113052745A
Digital watermark camouflage method based on reverse information entropy tracking
CN119577709A
Zoom agnostic watermark extraction
US20230325959A1
Cited By
A large model watermarking method based on dynamic entropy
CN121834773B
Language model multi-bit embedding-based imperceptible layered watermark embedding method
CN121997303A
Imperceptible hierarchical watermarking embedding method based on language model multi-bit embedding
CN121997303B