Generative text watermark embedding method based on semantic style and detection method thereof

By combining large language models and semantic coding models, the generative text watermarking embedding method achieves highly concealed and robust text watermarking embedding and detection while ensuring text quality and semantic coherence. It solves the problems of insufficient robustness and fidelity in existing technologies and supports fully blind detection.

CN121637464AActive Publication Date: 2026-03-10HUNAN NORMAL UNIVERSITY
View PDF 6 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-02-04
Publication Date
2026-03-10

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

Sentence segments are generated using a large language model, semantic vectors are extracted using a pre-trained semantic encoding model, mapped to binary style fingerprint sequences, and then combined with style instruction sequences to generate text through chain recursion. Style signals are embedded, and blind detection is performed without the need for original information.

Benefits of technology

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

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121637464A_ABST
    Figure CN121637464A_ABST
Patent Text Reader

Abstract

The invention provides a semantic style-based generative text watermark embedding method and a detection method thereof, and the method comprises two stages: watermark embedding and watermark detection: during embedding, dynamically generating a style fingerprint according to preamble semantics and mapping the style fingerprint into a style instruction; selecting a sentence with the complexity closest to the target style from a plurality of candidate sentences according to the style instruction to embed the watermark in a hidden manner, and generating a subsequent text in a chain recursion manner; during detection, style complexity observation values of sentences in a to-be-detected text are extracted and binarized, binarized style fingerprints are obtained, segmentation is carried out according to the same length, the matching degree of theoretical fingerprints obtained through semantic calculation in the previous text and binary style fingerprints extracted in the current segment is compared segment by segment, and the existence of watermarks is judged based on statistical hypothesis testing. And blind detection without an original model or cue word is realized. According to the method, the watermark signal is embedded into the text style dimension, so that the high quality of the text is ensured, and meanwhile, the method has high concealment and strong robustness.
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 tags ;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 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 tags ;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... Subsequently, 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 semantic style based generative text watermark embedding method, characterized in that, Comprising: 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: obtaining a semantic vector representing the overall semantics of the sentence segment by inputting the pre-trained semantic encoding model ; ; ; mapping the semantic vector ; ; ; ; Step S3: mapping the style instruction sequence to a style instruction sequence ; Step S4: Continue to generate the first sentence segment including ;​​ Step S5: generating the generated text according to the semantic encoding model and the input text As the input of the semantic encoding model, that is Steps S2 to S4 are repeatedly executed in a chain recursive manner to generate subsequent text; this process is looped until the text generation is completed.

2. The method of claim 1, wherein, In step S3, the mapping rule from the style fingerprint sequence to the style instruction sequence is that if the first bit of the style fingerprint sequence is 0, i.e. , then the first bit of the style instruction sequence, i.e. , is uniformly randomly sampled from the interval ; if the first bit of the style fingerprint sequence is 1, i.e. , then the first bit of the style instruction sequence, i.e. , is uniformly randomly sampled from the interval ; wherein is a pre-determined optimal style complexity threshold; and are respectively the lower and upper boundaries of a pre-determined style complexity interval.

3. The method of claim 2, wherein, In step S4, the sentence is generated by performing the following sub-steps: Step S41: Each sentence in the corresponds to a style instruction at a corresponding position; that is, Each sentence in the corresponds to a style instruction at a corresponding position; that is, ; Step S42: when generating a sentence , a semantic reasonable candidate sentence is generated by the large language model ; for each candidate sentence , , its linguistic features are extracted , where the superscript represents the candidate sentence number, and the subscript represents the linguistic feature number , represents the number of linguistic features; then the linguistic features are standardized and fused to obtain the style complexity observation value of each candidate sentence ; Specifically, first, the feature values are normalized using the Z-score method to obtain wherein denotes the normalization function; then, the normalized feature values are weighted and summed to calculate the style complexity observation value ; wherein denotes the th linguistic feature of the th candidate sentence; denotes the preset weight and ; finally, the is linearly scaled to the interval [0, 1]; The linguistic features include length features, lexical complexity, syntactic complexity, and modification features; wherein the length features include the number of characters, the number of word units, and the average word length; the lexical complexity includes part-of-speech distribution entropy and the proportion of difficult words; the syntactic complexity includes the number of clauses and the maximum depth of the dependency syntax tree; and the modification features include the density of adjectives and adverbs. Step S43: calculate the style complexity observation value of each candidate sentence with the style instruction The absolute difference value Select the candidate sentence with the smallest absolute difference value as the output sentence ; Step S44: obtaining by steps S42-S43 i.e. obtaining .

4. The method of claim 3, wherein, Optimal style complexity threshold The determination procedure is as follows: Step Q1: Collecting sentences, for each sentence annotating binary style labels wherein yields a calibration dataset comprising sentences and their binary style labels ; wherein, is a collection of human-annotated style labels; The sentences to be collected are required to cover a variety of different topics including science, literature, sports, and to range in length from short sentences to complex long sentences to ensure generalization ability at the threshold level. The sentences to be collected are required to cover a variety of different topics including science, literature, sports, and to range in length from short sentences to complex long sentences to ensure generalization ability at the threshold level. The annotation standard of binary style label is: if The simple sentence determination standard is met, that is, the sentence is short, the structure is straightforward, the vocabulary is common, and the modification component is less ; otherwise , that is , it is determined as 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, all candidate thresholds are traversed within the style complexity observation range, i.e., 0 to 1, with a step size of 0.01 For any candidate threshold , its corresponding true positive rate and false positive rate are calculated: where true positive rate denotes the calibration dataset where the style complexity observation is greater than the threshold and the proportion of binary style labels that are complex sentences, denotes the proportion of sentences where the style complexity observation is greater than the threshold and the number of sentences that are labeled as complex, denotes the number of sentences that are labeled as complex; false positive rate denotes the calibration dataset where the style complexity observation is greater than the threshold and the proportion of binary style labels that are simple sentences, denotes the proportion of sentences where the style complexity observation is greater than the threshold and the number of sentences that are labeled as simple, denotes the number of sentences that are labeled as simple; Then, a candidate threshold value is calculated The Youden index of And the optimal style complexity threshold value is solved by maximizing the Youden index as an optimization objective .

5. The method of claim 4, wherein, The lower bound of the style complexity interval and the upper bound are determined from the statistical distribution of the style complexity observations in the calibration data set.

6. The method of claim 5, wherein, In step S2, the semantic encoding model is all-MiniLM-L6-v2; The hash function uses SHA-256 truncation.

7. A semantic style based generative text watermarking detection method, characterized in that, The text obtained by the method of any one of claims 1-6 is acquired as the detection text; specifically including: Step T1: divide the detection text into a sequence of sentences and segment it into fixed length to obtain sentence segments, the th sentence segment is , wherein ; 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: The binary style fingerprint sequence is segmented to obtain Also in fixed length Segmented to obtain Binary style fingerprint segments ; Step T4: for the first sentence segment , its previous sentence segment is input into the semantic encoding model and the hash function to obtain a theoretical style fingerprint sequence ; Step T5: calculating the first binary style fingerprint segment and the theoretical style fingerprint sequence match degree , The number of bits that are the same at the corresponding positions is divided by the total number of bits, and the calculation formula is: ; wherein, represents the first bit of the sequence ; represents the first bit of the sequence ; represents an indication function, if then , if then ; Step T6: Calculate the overall watermark match of the detected text , the calculation formula is: ; Step T7: determining whether the watermark exists based on a statistical hypothesis.

8. The method of claim 7, wherein, Step T7 specifically includes: Step T71: Constructing hypotheses: Set up null hypothesis "Detecting no watermark in text", alternative hypothesis "Detecting presence of watermark in text"; Step T72: Obtain the baseline distribution parameters of the matching degree under the condition of no watermark, including the mean and the standard deviation , which are obtained by calculating the overall watermark matching degree statistics of all natural texts in the calibration data set; Step T73: Calculate the match degree of the detected text of the standardization statistics , the formula is: ; Step T74: determining the critical value from the standard normal distribution according to the preset significance level , determining a critical value from a standard normal distribution ; Step T75: Compare with ; if , reject the null hypothesis , determine that a watermark is present in the detected text; if , accept the null hypothesis , determine that a watermark is not present in the detected text.

Citation Information

Patent Citations

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

    CN118821086A

  • Large language model watermarking method based on semantic consistency

    CN118734801A

  • Big language model intellectual property protection method and device based on double-layer nested fingerprints

    CN120182052A

  • Multistage video watermark embedding and extracting method and system

    CN120358309A

  • Watermarking method and system for large language model generated text

    CN121302332A