A semantic style-based generative text watermark embedding method and a detection method thereof

By using a semantic style-based generative text watermarking embedding method, sentence segments are generated using a large language model and a semantic encoding model. Combined with hash functions and style instruction sequences, the problem of insufficient robustness and fidelity in existing technologies is solved, and a text watermarking scheme with strong concealment, high robustness and wide applicability is achieved.

CN121637464BActive Publication Date: 2026-04-28HUNAN NORMAL UNIVERSITY
View PDF 4 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUNAN NORMAL UNIVERSITY
Filing Date
2026-02-04
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing generative text watermarking technologies struggle to balance robustness and fidelity, and the detection process relies on specific rules or model parameters, limiting flexibility and making it difficult to effectively distinguish between AI-generated text and human-created text.

Method used

A generative text watermarking embedding method based on semantic style is adopted. Sentence segments are generated through a large language model, semantic vectors are extracted using a semantic encoding model and mapped to style fingerprint sequences, and style instruction sequences are generated by combining a hash function to achieve chain-recursive embedding. This ensures that the watermark is deeply bound to the semantics and does not require blind detection of the original information during detection.

Benefits of technology

It achieves highly concealed and robust text watermark embedding, supports fully blind detection, has wider applicability, and maintains high quality and semantic coherence of the generated text.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121637464B_ABST
    Figure CN121637464B_ABST
Patent Text Reader

Abstract

The application provides a semantic style-based generative text watermark embedding method and a detection method thereof, which comprises two stages of watermark embedding and watermark detection: in the embedding stage, a style fingerprint is dynamically generated according to the previous text semantics and is mapped into a style instruction, a sentence closest to the target style complexity is selected from multiple candidate sentences according to the style instruction to implicitly embed the watermark, and subsequent text is generated by chain recursion; in the detection stage, the style complexity observation value of each sentence in the text to be detected is extracted and binarized to obtain a binary style fingerprint, the binary style fingerprint is segmented according to the same length, the matching degree of the theoretical fingerprint calculated according to the previous text semantics and the binary style fingerprint extracted from the current segment is compared, the watermark existence is judged based on statistical hypothesis testing, and blind detection without the original model or prompt words is realized. The watermark signal is embedded in the text style dimension, high quality of the text is ensured, and high concealment and strong robustness are combined.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of information security technology, and in particular to a generative text watermark embedding method based on semantic style and its detection method. Background Technology

[0002] With the explosive growth of large language models (LLMs), AI-generated text is widely used in various fields such as content creation, customer service, educational assistance, and coding. However, this trend has also brought serious challenges. Humans currently find it difficult to effectively distinguish between AI-generated text and human-created text, which may lead to problems such as the spread of misinformation, academic misconduct, unclear copyright ownership, and contamination of the training data of large models themselves.

[0003] To address the aforementioned challenges, generative text watermarking technology offers a potential solution by embedding subtle identifying information into model-generated text without compromising text quality or semantics.

[0004] However, existing technical solutions generally face a trade-off between robustness (i.e., the ability to resist attacks such as text modification, polishing, and abbreviation) and fidelity (i.e., the text quality does not decrease after embedding a watermark). In existing solutions, some methods embed watermarks by modifying the probability distribution of word generation (such as the sentence semantic-based watermarking method for large language model paraphrasing attacks disclosed in Chinese invention patent application CN202410926631.X). Such solutions may lead to detectable biases in the statistical properties of the generated text, such as abnormal frequencies of specific words or patterns. Furthermore, their watermark detection process typically relies on specific rules (such as green lists) or model parameters used in the embedding stage, making it a non-blind detection method with limited flexibility in practical deployment.

[0005] Other methods attempt to leverage the deep semantic structure of text to carry watermark information (such as the large language model watermarking method based on semantic consistency disclosed in Chinese invention patent application CN202410724440.5). These methods often rely on structural features such as the logical order and referential relationships between paragraphs. Attackers can potentially destroy such watermarks by making local, non-semantic destructive edits to the text (such as adjusting sentence order or modifying transition words). Furthermore, to maintain these structural features, the generated text sometimes sacrifices some naturalness, and the detection process involves complex semantic analysis, resulting in significant computational overhead. Summary of the Invention

[0006] (a) Technical problems to be solved

[0007] Based on this, the present invention provides a generative text watermark embedding method and its detection method based on semantic style, in order to solve the problems of weak robustness and low fidelity of generative text watermarks mentioned in the background art. Under the premise of ensuring high quality and semantic coherence of the generated text, a text watermarking scheme with high concealment, strong robustness and detection without the need for original information is achieved.

[0008] (II) Technical Solution

[0009] To achieve the above objectives, this invention provides a semantic style-based generative text watermark embedding method, comprising:

[0010] Step S1: The large language model freely generates, without any watermarking intervention, based on the input prompts. The first sentence Sentences ,at this time ; where subscript This indicates the first [section / part] in this sentence / segment. a sentence, and ;

[0011] Step S2: Input pre-trained semantic encoding model This yields a semantic vector representing the overall semantic meaning of the sentence segment. ; through hash function semantic vectors Mapped to a Bit-based binary style fingerprint sequence ;

[0012] Step S3: [The text appears to be incomplete and contains several grammatical errors. A more accurate translation would require the full Mapped to a sequence of style instructions ;

[0013] Step S4: Continue generating including The first sentence Sentences ;

[0014] Step S5: Generate As input to the semantic coding model, i.e. Repeat steps S2 to S4 to generate subsequent text in a chain-recursive manner; this process is repeated until the text generation is complete.

[0015] Specifically, in step S3, from the style fingerprint sequence To style instruction sequence The mapping rule is: if the style fingerprint sequence's first... The bit is 0, that is Then the first style instruction sequence Position, that is From the interval Uniform random sampling within the style fingerprint sequence; if the style fingerprint sequence's first... The bit is 1, that is Then the first style instruction sequence Position, that is From the interval Uniform random sampling within the area; where, The optimal style complexity threshold is predetermined; and These are the lower and upper boundaries of a pre-determined style complexity range, respectively.

[0016] Specifically, in step S4, a sentence is generated by performing the following sub-steps:

[0017] Step S41: Each sentence in the text corresponds to The style instructions for the corresponding location; that is, Each sentence The corresponding style instruction is ;

[0018] Step S42: In generating sentences At that time, generated by the large language model A semantically reasonable candidate sentence For each candidate sentence , Extract its linguistic features , where superscript Indicates the candidate sentence number, subscript Indicates linguistic feature number, , The number of linguistic features is represented; then, the linguistic features are standardized and fused to obtain the style complexity observation value for each candidate sentence. ;

[0019] Specifically, firstly, the Z-score method is used to extract the eigenvalues. Standardize to obtain ,in, The standardization function is represented; then, the style complexity observations are calculated by weighted summation of the standardized eigenvalues. ;in, Indicates the first The first candidate sentence A linguistic feature; Indicates the preset weight and Finally, Linearly scale to the interval [0,1];

[0020] The linguistic features include length features, lexical complexity, syntactic complexity, and modification features; among them, length features include the number of characters, the number of lexical units, and the average word length; lexical complexity includes the part-of-speech distribution entropy and the proportion of long and difficult words; syntactic complexity includes the number of clauses and the maximum depth of the dependency syntax tree; and modification features include the density of adjectives and adverbs.

[0021] Step S43: Calculate the style complexity observation for each candidate sentence. With style instructions absolute difference Select the candidate sentence with the smallest absolute difference as the output sentence. ;

[0022] Step S44: Obtained through steps S42-S43 That is, to obtain .

[0023] Specifically, the optimal style complexity threshold The determination process is as follows:

[0024] Step Q1: Collection Each sentence is collected. Binary style tags ,in , to obtain A calibration dataset of sentences and their binary style labels ;in, A collection of manually annotated style tags;

[0025] Required collection The sentences cover multiple different topics including science and technology, literature, and sports, ranging in length from short sentences to complex long sentences to ensure the generalization ability of the threshold;

[0026] The standard for labeling binary style tags is: if If a sentence meets the criteria for a simple sentence—that is, it is short, straightforward in structure, uses common vocabulary, and has few modifiers—then it is considered a simple sentence. ;otherwise ,Right now It was judged to be a complex sentence;

[0027] Step Q2: For the calibration dataset Each sentence in The style complexity observations are calculated using the same method as in step S42. This forms a set of style complexity observations. That is, for each sentence The linguistic features are extracted, and then standardized and fused to obtain... Style complexity observations ;

[0028] Step Q3: Based on sets and Determine the optimal style complexity threshold ;

[0029] Specifically, within the range of style complexity observations, i.e., from 0 to 1, all candidate thresholds are traversed with a step size of 0.01. For any candidate threshold Calculate its corresponding true yang rate With false positive rate :

[0030]

[0031]

[0032] Among them, the true yang rate Represents calibration dataset The number of medium style complexity observations is greater than the threshold. Furthermore, the proportion of binary style tags representing complex sentences is high. The style complexity observation is greater than the threshold. And the number of sentences labeled as complex sentences, The number of sentences labeled as complex sentences; false positive rate. Represents calibration dataset The number of medium style complexity observations is greater than the threshold. Furthermore, the proportion of binary style tags that are simple sentences is high. The style complexity observation is greater than the threshold. And the number of sentences tagged as simple sentences, This indicates the number of sentences labeled as simple sentences;

[0033] Then, calculate the candidate threshold. Yoden Index The optimal style complexity threshold is obtained by maximizing the Youden exponent. .

[0034] Specifically, the lower bound of the style complexity range and upper boundary The value is determined by the statistical distribution of style complexity observations in the calibration dataset.

[0035] Specifically, in step S2, the semantic encoding model For all-MiniLM-L6-v2; the hash function uses SHA-256 truncation.

[0036] On the other hand, the present invention also provides a generative text watermark detection method based on semantic style, which obtains the text obtained by the above method as the detection text; specifically including:

[0037] Step T1: Segment the detected text into sentence sequences. and according to a fixed length Segmentation is performed to obtain The sentence segment, the first The sentence segment is ,in ;

[0038] Step T2: For the sequence Each sentence in , The style complexity observations are calculated using the same method as in step S42. This forms a set of style complexity observations. Based on the optimal style complexity threshold ,Will Convert to binary style fingerprint sequence The conversion rule is: if ,but ;like ,but ;

[0039] Step T3: Convert the binary style fingerprint sequence Also according to a fixed length Segmentation is performed to obtain A binary-style fingerprint segment ;

[0040] Step T4: For the first Sentences The preceding sentence segment Input the semantic coding model in step S2 and hash function A theoretical style fingerprint sequence was calculated. ;

[0041] Step T5: Calculate the first... A binary-style fingerprint segment With theoretical style fingerprint sequence Matching degree , The formula for calculating the percentage of bits that are the same at corresponding positions for both is: ;in, Represents a sequence The Bit; Represents a sequence The Bit; Indicates an indicator function, if but ,like but ;

[0042] Step T6: Calculate the overall watermark matching degree of the detected text. The calculation formula is: ;

[0043] Step T7: Determine whether the watermark exists based on statistical assumptions.

[0044] Specifically, step T7 includes:

[0045] Step T71: Constructing Hypotheses: Establishing the Null Hypothesis Alternative hypothesis for "detecting the absence of watermarks in text" The function is to "detect watermarks in the text".

[0046] Step T72: Obtain the baseline distribution parameters of the matching degree under the watermark-free condition, including the mean. and standard deviation The parameters are obtained by calculating the overall watermark matching degree statistics of all natural text in the calibration dataset;

[0047] Step T73: Calculate the matching degree of the detected text. Standardized statistics The formula is: ;

[0048] Step T74: Based on the preset significance level Determining the critical value from the standard normal distribution ;

[0049] Step T75: Comparison and ;like Then reject the null hypothesis. The system determines that a watermark exists in the detected text; if Then accept the null hypothesis. The system determined that no watermark was present in the detected text.

[0050] (III) Beneficial Effects

[0051] As can be seen from the above technical solutions, the beneficial effects of the generative text watermark embedding method and its detection method based on semantic style proposed in this invention are as follows:

[0052] 1. In the watermark embedding stage, the watermark signal can be adaptively and covertly embedded into the whole text through a "rolling" chain recursion mechanism. Each embedding step depends on the semantics of the preceding text, ensuring a deep binding between the watermark and the semantics; it has good fidelity and robustness.

[0053] 2. In the watermark detection stage, fully blind detection is achieved without the need for original information, making it more widely applicable. Attached Figure Description

[0054] The features and advantages of the invention will be more clearly understood by referring to the accompanying drawings, which are schematic and should not be construed as limiting the invention in any way. In the drawings:

[0055] Figure 1 This is a schematic diagram illustrating the principle of the semantic style-based generative text watermarking embedding method and its detection method of the present invention.

[0056] Figure 2 This is a flowchart illustrating the semantic style-based generative text watermarking embedding method of the present invention.

[0057] Figure 3 Determining the optimal style complexity threshold for this invention A flowchart;

[0058] Figure 4 This is a flowchart illustrating the generative text watermark detection method based on semantic style of the present invention. Detailed Implementation

[0059] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0060] This invention provides a generative text watermark embedding method and its detection method based on semantic style. Its core lies in implicitly embedding the watermark signal into the style dimension of the text, thereby achieving watermark embedding with high concealment and high semantic preservation, and supporting blind detection without the need for the original model or prompt words.

[0061] like Figure 1 As shown, the present invention provides a generative text watermark embedding method based on semantic style, which specifically includes:

[0062] Step S1: The large language model freely generates, without any watermarking intervention, based on the input prompts. The first sentence Sentences ,at this time ; where subscript This indicates the first [section / part] in this sentence / segment. One sentence;

[0063] In this embodiment, take The large language model freely generates initial sentence segments based on input prompts without any watermarking intervention. .

[0064] Step S2: Input pre-trained semantic encoding model This yields a semantic vector representing the overall semantic meaning of the sentence segment. ; through hash function semantic vectors Mapped to a Bit-based binary style fingerprint sequence ;

[0065] In this embodiment, the semantic coding model uses all-MiniLM-L6-v2, and the hash function uses SHA-256 truncation. Input the pre-trained semantic encoding model to obtain semantic vectors. Then, using a hash function, it is mapped to a 3-bit binary-style fingerprint sequence. .

[0066] Step S3: [The text appears to be incomplete and contains several grammatical errors. A more accurate translation would require the full Mapped to a sequence of style instructions ;

[0067] From style fingerprint sequence To style instruction sequence The mapping rule is: if the style fingerprint sequence's first... The bit is 0 (i.e.) ), then the first style instruction sequence bit (i.e.) From the interval Uniform random sampling within the style fingerprint sequence; if the style fingerprint sequence's first... Bit is 1 (i.e.) ), then the first style instruction sequence bit (i.e.) From the interval Uniform random sampling within the area; where, The optimal style complexity threshold is predetermined; and These are the upper and lower boundaries of a predetermined style complexity interval, and their values ​​are determined by the statistical distribution of style complexity observations in the calibration dataset.

[0068] In this embodiment, , , Binary style fingerprint sequence Mapped to a sequence of style instructions .

[0069] The uniform random sampling in the above mapping rules ensures security and concealment, and avoids the watermark from exhibiting regularity that makes it easy to analyze and attack.

[0070] like Figure 2 As shown, the optimal style complexity threshold The determination process is as follows:

[0071] Step Q1: Collection Each sentence is collected. Binary style tags , to obtain A calibration dataset of sentences and their binary style labels ;in, A collection of manually annotated style tags;

[0072] Required collection The sentences cover a variety of topics, including science and technology, literature, and sports, and range in length from short sentences to complex long sentences to ensure the generalization ability of the threshold.

[0073] The standard for labeling binary style tags is: if If a sentence meets the criteria for a simple sentence, namely, it is short (usually ≤15 words), has a straightforward structure (subject-verb-object), uses common vocabulary, and has few modifying elements (adjectives, adverbs, clauses), then... ;otherwise ,Right now It was judged to be a complex sentence.

[0074] In this embodiment, data was collected from the BBC News dataset. A sentence.

[0075] Step Q2: For the calibration dataset Each sentence in The style complexity observations are calculated using the same method as in step S42. This forms a set of style complexity observations. That is, for each sentence The linguistic features are extracted, and then standardized and fused to obtain... Style complexity observations ;

[0076] Step Q3: Based on sets and Determine the optimal style complexity threshold ;

[0077] Specifically, all candidate thresholds are iterated over with a step size of 0.01 within the range of style complexity observations (0 to 1). For any candidate threshold Calculate its corresponding true yang rate With false positive rate :

[0078]

[0079]

[0080] Among them, the true yang rate Represents calibration dataset The number of medium style complexity observations is greater than the threshold. Furthermore, the proportion of binary style tags representing complex sentences is high. The style complexity observation is greater than the threshold. And the number of sentences labeled as complex sentences, The number of sentences labeled as complex sentences; false positive rate. Represents calibration dataset The number of medium style complexity observations is greater than the threshold. Furthermore, the proportion of binary style tags that are simple sentences is high. The style complexity observation is greater than the threshold. And the number of sentences tagged as simple sentences, This indicates the number of sentences labeled as simple sentences;

[0081] Then, calculate the candidate threshold. Yoden Index The optimal style complexity threshold is obtained by maximizing the Youden exponent. .

[0082] In this embodiment, the calculation is obtained .

[0083] Step S4: Continue generating including The first sentence Sentences ;

[0084] Specifically, sentences are generated by performing the following sub-steps:

[0085] Step S41: Each sentence in the text corresponds to The style instructions for the corresponding location; that is, Each sentence The corresponding style instruction is ;

[0086] Step S42: In generating sentences At that time, generated by the large language model A semantically reasonable candidate sentence For each candidate sentence Extract its linguistic features , where superscript Indicates the candidate sentence number, subscript Indicates linguistic feature number, The number of linguistic features is represented; then, the linguistic features are standardized and fused to obtain the style complexity observation value for each candidate sentence. ;

[0087] Specifically, firstly, the Z-score method is used to extract the eigenvalues. Standardize to obtain ,in, The standardization function is represented; then, the style complexity observations are calculated by weighted summation of the standardized eigenvalues. ;in, Indicates the first The first candidate sentence A linguistic feature; Indicates the preset weight and Finally, Linearly scale to the interval [0,1].

[0088] The linguistic features include length features, lexical complexity, syntactic complexity, and modification features; among them, length features include the number of characters, the number of lexical units, and the average word length; lexical complexity includes the part-of-speech distribution entropy and the proportion of long and difficult words (length > 6 characters); syntactic complexity includes the number of clauses and the maximum depth of the dependency syntax tree; and modification features include the density of adjectives and adverbs.

[0089] Step S43: Calculate the style complexity observation for each candidate sentence. With style instructions absolute difference Select the candidate sentence with the smallest absolute difference as the output sentence. ;

[0090] Step S44: Obtained through steps S42-S43 That is, to obtain .

[0091] In this embodiment, based on style instructions The following three sentences, or sentence segments, are generated using a chain-recursive approach. Specifically, this includes:

[0092] (1) Each sentence The corresponding style instruction is ;

[0093] (2) Generation :Pick The large language model generates three semantically reasonable candidate sentences. For each candidate sentence Extract its linguistic features and calculate its feature values. Here was extracted Each linguistic feature value is standardized and fused, and each feature value is... Standardization was performed using the Z-score method to obtain... Then, according to the preset weight vector... We perform a weighted summation to obtain the style observations of the candidate sentences. Finally, all of them Linear scaling to the interval [0,1] yields the style complexity observations for the three candidate sentences: ; Calculate the style complexity observation for each candidate sentence With style instructions absolute difference ,get , , Select the candidate sentence with the smallest absolute difference. The sentence as the final output .

[0094] (3) Repeat step (2) to generate sequentially. (Corresponding style instructions) )and (Corresponding style instructions) ), to obtain sentence segments .

[0095] Step S5: Generate As input to the semantic coding model, i.e. Repeat steps S2 to S4 to generate subsequent text in a chain-recursive manner; this process is repeated until the text generation is complete.

[0096] In other words, for any ,based on Generating style fingerprint sequences and style instruction sequence This will then generate the next sentence segment. .

[0097] In this embodiment, the generated sentence segment As new input, steps S2 to S4 are repeated to obtain its style fingerprint sequence. and style instruction sequence This then guides the generation of the next sentence segment. ; The generated sentence segment Then, using this as new input, steps S2 to S4 are repeated to obtain its style fingerprint sequence. and style instruction sequence This then guides the generation of the next sentence segment. This process is repeated until the text generation is complete.

[0098] Through this "rolling" chain-recursive mechanism, the watermark signal can be adaptively and covertly embedded in the whole text, and each embedding step depends on the semantics of the preceding text, ensuring a deep binding between the watermark and the semantics.

[0099] like Figure 3 As shown, the present invention provides a generative text watermark detection method based on semantic style, wherein the detected text is the text obtained by the aforementioned generative text watermark embedding method based on semantic style, specifically including:

[0100] Step T1: Segment the detected text into sentence sequences. and according to a fixed length Segmentation is performed to obtain The sentence segment, the first The sentence segment is ,in ;

[0101] In this embodiment, the detected text is the text obtained from the aforementioned embodiment of the semantic style-based generative text watermark embedding method, and the detected text is segmented into sentence sequences using the sentence segmentation tool spaCy. The value is the same as the value during the watermark embedding stage, that is... Assuming , Detect the text by Segmentation, resulting in The sentence segments are as follows: , , .

[0102] Step T2: For the sequence Each sentence in The style complexity observations are calculated using the same method as in step S42. This forms a set of style complexity observations. Based on the optimal style complexity threshold ,Will Convert to binary style fingerprint sequence The conversion rule is: if ,but ;like ,but ;

[0103] In this embodiment, The value is the same as the value during the watermark embedding stage, that is... .get = (0.82, 0.42, 0.75, 0.88, 0.38, 0.70, 0.90, 0.45, 0.78), binary-style fingerprint sequence = (1, 0, 1, 1, 0, 1, 1, 0, 1).

[0104] Step T3: Convert the binary style fingerprint sequence Also according to a fixed length Segmentation is performed to obtain A binary-style fingerprint segment ;

[0105] In this embodiment, By the same length After segmentation, we get: = (1, 0, 1) = (1, 0, 1) = (1, 0, 1).

[0106] Step T4: For the first Sentences The preceding sentence segment Input the semantic coding model in step S2 and hash function A theoretical style fingerprint sequence was calculated. ;

[0107] In this embodiment, for the second segment ( ): Assume the calculation result is: = (1, 0, 1); for the 3rd segment ( ): Assuming the calculation result is also: = (1, 0, 1);

[0108] Step T5: Calculate the first... A binary-style fingerprint segment With theoretical style fingerprint sequence Matching degree , The formula for calculating the percentage of bits that are the same at corresponding positions for both is: ;in, Represents a sequence The Bit; Represents a sequence The Bit; Indicates an indicator function, if but ,like but ;

[0109] In this embodiment, the calculation is as follows:

[0110] ;

[0111] ;

[0112] Step T6: Calculate the overall watermark matching degree of the detected text. The calculation formula is: ;

[0113] In this embodiment, the calculation is as follows: .

[0114] Step T7: Determine whether the watermark exists based on statistical assumptions, specifically including:

[0115] Step T71: Constructing Hypotheses: Establishing the Null Hypothesis Alternative hypothesis for "detecting the absence of watermarks in text" The function is to "detect watermarks in the text".

[0116] Step T72: Obtain the baseline distribution parameters (including mean) of the matching degree under the watermark-free condition. and standard deviation The parameters are obtained by calculating the overall watermark matching degree statistics of all natural text in the calibration dataset;

[0117] In this embodiment, the matching degree of the watermark-free text is obtained based on statistics of all natural text in the calibration dataset. It follows a normal distribution, and its mean is Standard deviation .

[0118] Step T73: Calculate the matching degree of the detected text. Standardized statistics The formula is: ;

[0119] Step T74: Based on the preset significance level Determining the critical value from the standard normal distribution ;

[0120] Step T75: Comparison and ;like Then reject the null hypothesis. The system determines that a watermark exists in the detected text; if Then accept the null hypothesis. The system determined that no watermark was present in the detected text.

[0121] In this embodiment, let The corresponding upper quantile of the standard normal distribution Then calculate the standardized statistic. ; Make a decision at the significance level Below, critical value .because Reject the null hypothesis The system determined that the detected text contained a watermark signal.

[0122] Compared with existing technologies, the advantages of this invention are: it binds watermarks to semantic depth, achieves covert embedding by adjusting style complexity, supports fully blind detection and statistical verification, and has the characteristics of high concealment and strong robustness.

[0123] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in the present invention should be included within the scope of protection of the present invention.

Claims

1. A generative text watermark embedding method based on semantic style, characterized in that, include: Step S1: The large language model freely generates, without any watermarking intervention, based on the input prompts. The first sentence Sentences ,at this time ; where subscript This indicates the first [section / part] in this sentence / segment. a sentence, and ; Step S2: Input pre-trained semantic encoding model This yields a semantic vector representing the overall semantic meaning of the sentence segment. ; through hash function semantic vectors Mapped to a Bit-based binary style fingerprint sequence ; Step S3: [The text appears to be incomplete and contains several grammatical errors. A more accurate translation would require the full context.] Mapped to a sequence of style instructions ; From style fingerprint sequence To style instruction sequence The mapping rule is: if the style fingerprint sequence's first... The bit is 0, that is Then the first style instruction sequence Position, that is From the interval Uniform random sampling within the style fingerprint sequence; if the style fingerprint sequence's first... The bit is 1, that is Then the first style instruction sequence Position, that is From the interval Uniform random sampling within the area; where, The optimal style complexity threshold is predetermined; and These are the lower and upper boundaries of a pre-determined style complexity range, respectively. Step S4: Continue generating including The first sentence Sentences ; Step S5: Generate As input to the semantic coding model, i.e. Repeat steps S2 to S4 to generate subsequent text in a chain-recursive manner; this process is repeated until the text generation is complete.

2. The method according to claim 1, characterized in that, In step S4, a sentence is generated by performing the following sub-steps: Step S41: Each sentence in the text corresponds to The style instructions for the corresponding location; that is, Each sentence The corresponding style instruction is ; Step S42: In generating sentences At that time, generated by the large language model A semantically reasonable candidate sentence For each candidate sentence , Extract its linguistic features , where superscript Indicates the candidate sentence number, subscript Indicates linguistic feature number, , The number of linguistic features is represented; then, the linguistic features are standardized and fused to obtain the style complexity observation value for each candidate sentence. ; Specifically, firstly, the Z-score method is used to extract the eigenvalues. Standardize to obtain ,in, The standardization function is represented; then, the style complexity observations are calculated by weighted summation of the standardized eigenvalues. ;in, Indicates the first The first candidate sentence A linguistic feature; Indicates the preset weight and Finally, Linearly scale to the interval [0,1]; The linguistic features include length features, lexical complexity, syntactic complexity, and modification features; among them, length features include the number of characters, the number of lexical units, and the average word length; lexical complexity includes the part-of-speech distribution entropy and the proportion of long and difficult words; syntactic complexity includes the number of clauses and the maximum depth of the dependency syntax tree; and modification features include the density of adjectives and adverbs. Step S43: Calculate the style complexity observation for each candidate sentence. With style instructions absolute difference Select the candidate sentence with the smallest absolute difference as the output sentence. ; Step S44: Obtained through steps S42-S43 That is, to obtain .

3. The method according to claim 2, characterized in that, Optimal style complexity threshold The determination process is as follows: Step Q1: Collection Each sentence is collected. Binary style tags ,in , to obtain A calibration dataset of sentences and their binary style tags ;in, A collection of manually annotated style tags; Required collection The sentences cover multiple different topics including science and technology, literature, and sports, ranging in length from short sentences to complex long sentences to ensure the generalization ability of the threshold; The standard for labeling binary style tags is: if If a sentence meets the criteria for a simple sentence—that is, it is short, straightforward in structure, uses common vocabulary, and has few modifiers—then it is considered a simple sentence. ;otherwise ,Right now It was judged to be a complex sentence; Step Q2: For the calibration dataset Each sentence in The style complexity observations are calculated using the same method as in step S42. This forms a set of style complexity observations. That is, for each sentence The linguistic features are extracted, and then standardized and fused to obtain... Style complexity observations ; Step Q3: Based on sets and Determine the optimal style complexity threshold ; Specifically, within the range of style complexity observations, i.e., from 0 to 1, all candidate thresholds are traversed with a step size of 0.

01. For any candidate threshold Calculate its corresponding true yang rate With false positive rate : Among them, the true yang rate Represents calibration dataset The number of medium style complexity observations is greater than the threshold. Furthermore, the proportion of binary style tags representing complex sentences is high. The style complexity observation is greater than the threshold. And the number of sentences labeled as complex sentences, The number of sentences labeled as complex sentences; false positive rate. Represents calibration dataset The number of medium style complexity observations is greater than the threshold. Furthermore, the proportion of binary style tags that are simple sentences is high. The style complexity observation is greater than the threshold. And the number of sentences tagged as simple sentences, This indicates the number of sentences labeled as simple sentences; Then, calculate the candidate threshold. Yoden Index The optimal style complexity threshold is obtained by maximizing the Youden exponent. .

4. The method according to claim 3, characterized in that, Lower bound of style complexity range and upper boundary The value is determined by the statistical distribution of style complexity observations in the calibration dataset.

5. The method according to claim 4, characterized in that, In step S2, the semantic encoding model For all-MiniLM-L6-v2; The hash function uses SHA-256 truncation.

6. A generative text watermark detection method based on semantic style, characterized in that, Obtain the text obtained by the method described in any one of claims 1-5 as the detection text; specifically including: Step T1: Segment the detected text into sentence sequences. and according to a fixed length Segmentation is performed to obtain The sentence segment, the first The sentence segment is ,in ; Step T2: For the sequence Each sentence in , The style complexity observations are calculated using the same method as in step S42. This forms a set of style complexity observations. Based on the optimal style complexity threshold ,Will Convert to binary style fingerprint sequence The conversion rule is: if ,but ;like ,but ; Step T3: Convert the binary style fingerprint sequence Also according to a fixed length Segmentation is performed to obtain A binary-style fingerprint segment ; Step T4: For the first Sentences The preceding sentence segment Input the semantic coding model in step S2 and hash function A theoretical style fingerprint sequence was calculated. ; Step T5: Calculate the first... A binary-style fingerprint segment With theoretical style fingerprint sequence Matching degree , The formula for calculating the percentage of bits that are the same at corresponding positions for both is: ;in, Represents a sequence The Bit; Represents a sequence The Bit; Indicates an indicator function, if but ,like but ; Step T6: Calculate the overall watermark matching degree of the detected text. The calculation formula is: ; Step T7: Determine whether the watermark exists based on statistical assumptions.

7. The method according to claim 6, characterized in that, Step T7 specifically includes: Step T71: Constructing Hypotheses: Establishing the Null Hypothesis Alternative hypothesis for "detecting the absence of watermarks in text" The function is "to detect watermarks in text"; Step T72: Obtain the baseline distribution parameters of the matching degree under the watermark-free condition, including the mean. and standard deviation The parameters are obtained by calculating the overall watermark matching degree statistics of all natural text in the calibration dataset; Step T73: Calculate the matching degree of the detected text. Standardized statistics The formula is: ; Step T74: Based on the preset significance level Determining the critical value from the standard normal distribution ; Step T75: Comparison and ;like Then reject the null hypothesis. The system determines that a watermark exists in the detected text; if Then accept the null hypothesis. The system determined that no watermark was present in the detected text.

Citation Information

Patent Citations

  • Large language model watermarking method based on semantic consistency

    CN118734801A

  • Sentence semantics-based watermarking method for large language model transfer attack

    CN118821086A

  • Multistage video watermark embedding and extracting method and system

    CN120358309A

  • Watermarking method and system for large language model generated text

    CN121302332A