Watermark detection method, device, equipment, storage medium and product using single detector

By embedding signatures in the text generated by LLM and extracting the target signature, and using the private key of a single detector for watermark detection, the problem of text quality degradation and generation randomness loss caused by watermark detection in the existing technology is solved, and high accuracy is achieved Text watermark detection for security and safety.

CN118885990BActive Publication Date: 2025-01-21PENG CHENG LAB
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411305507.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2025-01-21
Estimated Expiration
2044-09-19

AI Technical Summary

Technical Problem

When detecting text watermarks generated by LLM, existing watermark detection methods often suffer from degradation in text quality or sacrifice of generation randomness, resulting in high false alarm rates, output quality loss and inconvenient detection by third parties.

Method used

By judging whether the initial text can be embedded with a signature, if so, the target text with embedded watermark is generated, and the target signature is extracted from the target text, and the private key of a single detector is used for watermark detection to ensure that only a specified single detector can detect it. watermark.

Benefits of technology

It achieves effective text watermark detection when a single detector is specified, avoiding the degradation of text quality and the loss of randomness in generation, while improving the accuracy and security of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118885990B_ABST
    Figure CN118885990B_ABST
Patent Text Reader

Abstract

The present application belongs to the field of artificial intelligence technology, and discloses a watermark detection method, device, equipment, storage medium and product of a single detector. The present application determines whether the initial text can be embedded with a signature based on the initial text length, preset text length and preset signature length corresponding to the initial text. If so, a target text embedded with a watermark is generated based on the prompt text, and then the target signature is extracted from the target text, and the target text is watermarked according to the preset text length, preset signature length, target signature and the private key of the single detector. The present application generates a target text embedded with a watermark based on the prompt text, and performs watermark detection on the target text according to the preset text length, preset signature length, target signature and the private key of the single detector, which can allow a specified single detector to detect a text watermark, that is, except for these specified detectors, other ordinary users will not be able to detect the text watermark, thereby effectively performing text watermark detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence technology, and in particular to a watermark detection method, device, equipment, storage medium and product using a single detector. Background Art

[0002] Generative artificial intelligence technology, especially large language models (LLMs), has shown significant advantages in the field of language generation and has achieved excellent performance in multiple downstream tasks such as machine translation, dialogue systems, code generation, and the medical field. However, with the continuous advancement of LLM technology, LLM will generate text that is difficult to distinguish from human works. Existing watermark detection methods are often accompanied by a decline in text quality, or sacrifice the randomness of LLM text generation, and there are challenges such as high false alarm rate, output quality loss, and inconvenience for third-party detection. Therefore, how to effectively perform text watermark detection when specifying a single detector has become a problem that needs to be solved. Summary of the invention

[0003] The main purpose of the present application is to provide a watermark detection method, device, equipment, storage medium and product for a single detector, aiming to solve the technical problem of how to effectively perform text watermark detection when a single detector is specified.

[0004] To achieve the above object, the present application provides a watermark detection method using a single detector, and the watermark detection method using a single detector comprises the following steps:

[0005] Determining whether the initial text can be embedded with a signature based on the initial text length, the preset text length, and the preset signature length corresponding to the initial text;

[0006] If yes, then generate the target text embedded with watermark according to the prompt text;

[0007] A target signature is extracted from the target text, and watermark detection is performed on the target text according to the preset text length, the preset signature length, the target signature and a private key of a single detector.

[0008] Optionally, if yes, the step of generating a target text for embedding a watermark according to the prompt text specifically includes:

[0009] If yes, the prompt text is input into the large language model to obtain an initial output text with a text length equal to the preset text length;

[0010] Signing the initial output text, and determining whether the generated initial signature is empty;

[0011] If yes, return to the step of inputting the prompt text into the large language model to obtain the initial output text until the new signature is not empty;

[0012] The target text for embedding the watermark is determined according to the new signature.

[0013] Optionally, the step of determining the target text to be embedded with the watermark according to the new signature specifically includes:

[0014] Determine an initial bit value and a target signature according to the new signature, and generate a target output text with a text length of the preset text length through the large language model;

[0015] Determining whether the target output text and the initial bit value satisfy a first preset relationship;

[0016] If not, a new target output text having a text length equal to the preset text length is generated by the large language model, and the step of determining whether the target output text and the initial bit value satisfy a preset relationship is returned to until the new target output text and the initial bit value satisfy the preset relationship;

[0017] The target text for embedding the watermark is determined according to the new target output text.

[0018] Optionally, the step of extracting a target signature from the target text and performing watermark detection on the target text according to the preset text length, the preset signature length, the target signature and a private key of a single detector specifically includes:

[0019] Determining whether the first initial value, the preset text length, and the preset signature length satisfy a second preset relationship;

[0020] If yes, calculating a hash value based on the target text and the first initial value;

[0021] Determining whether the second initial value is less than or equal to the preset signature length;

[0022] If not, extract the target signature from the target text, and perform watermark detection on the target text according to the target signature, the private key of the single detector, and the hash value.

[0023] Optionally, if not, extracting a target signature from the target text, and performing watermark detection on the target text according to the target signature, a private key of a single detector, and the hash value, specifically includes:

[0024] If not, extracting the target signature from the target text, and calculating the signature verification value according to the private key of the single detector, the hash value, and the target signature;

[0025] When the signature verification value is not 1, generating a new first initial value, and returning to the step of determining whether the first initial value, the preset text length, and the preset signature length satisfy a second preset relationship;

[0026] If not, it is determined that there is no watermark in the target text.

[0027] Optionally, the step of calculating the signature verification value according to the private key of the single detector, the hash value, and the target signature specifically includes:

[0028] Extracting variables in the target signature to obtain a first variable and a second variable;

[0029] Calculate a target hash value according to the first variable and the hash value;

[0030] When an equation consisting of the second variable, the target hash value, the private key of the single detector, and the public key of the model provider holds true, the signature verification value is determined to be 1.

[0031] In addition, to achieve the above-mentioned purpose, the present application also provides a watermark detection device with a single detector, and the watermark detection device with a single detector comprises:

[0032] A signature judgment module, used to judge whether the initial text can be embedded with a signature according to the initial text length, the preset text length and the preset signature length corresponding to the initial text;

[0033] A text generation module, used to generate a target text for embedding a watermark according to the prompt text when the initial text can be embedded with a signature;

[0034] The watermark detection module is used to extract the target signature from the target text and perform watermark detection on the target text according to the preset text length, the preset signature length, the target signature and the private key of the single detector.

[0035] In addition, to achieve the above-mentioned objectives, the present application also proposes a single-detector watermark detection device, which includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the computer program is configured to implement the steps of the single-detector watermark detection method as described above.

[0036] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the watermark detection method of the single detector as described above are implemented.

[0037] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the watermark detection method of the single detector as described above are implemented.

[0038] This application determines whether the initial text can be embedded with a signature based on the initial text length, preset text length, and preset signature length corresponding to the initial text. If so, a target text embedded with a watermark is generated based on the prompt text, and then the target signature is extracted from the target text, and the target text is watermarked according to the preset text length, preset signature length, target signature, and the private key of a single detector. When the initial text can be embedded with a signature, this application generates a target text embedded with a watermark based on the prompt text, and performs watermark detection on the target text based on the preset text length, preset signature length, target signature, and the private key of a single detector, which can allow a specified single detector to detect text watermarks, that is, except for these specified detectors, other ordinary users will not be able to detect text watermarks, thereby effectively performing text watermark detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0041] Figure 1 This is a flow chart of the first embodiment of the watermark detection method of the detector of the present application;

[0042] Figure 2 This is a flow chart of the second embodiment of the watermark detection method of the detector of the present application;

[0043] Figure 3 A schematic diagram of the process of watermark generation of a watermark detection method according to an embodiment of the present application;

[0044] Figure 4 This is a flow chart of the third embodiment of the watermark detection method of the single detector of the present application;

[0045] Figure 5 A schematic diagram of the watermark detection process of an embodiment of a watermark detection method of a single detector of the present application;

[0046] Figure 6This is a structural block diagram of the first embodiment of the watermark detection device of the single detector of the present application;

[0047] Figure 7 It is a structural diagram of a watermark detection device with a single detector in the hardware operating environment involved in the embodiment of the present application.

[0048] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0049] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0050] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0051] The main solution of the embodiment of the present application is: to determine whether the initial text can be embedded with a signature based on the initial text length, the preset text length and the preset signature length corresponding to the initial text; if so, to generate a target text embedded with a watermark based on the prompt text; to extract the target signature from the target text, and to perform watermark detection on the target text based on the preset text length, the preset signature length, the target signature and the private key of the single detector.

[0052] Generative artificial intelligence technology, especially large language models (LLM), has shown significant advantages in the field of language generation and has achieved excellent performance in multiple downstream tasks such as machine translation, dialogue systems, code generation, and the medical field. However, with the continuous advancement of LLM technology, LLM will generate text that is difficult to distinguish from human works. Existing watermark detection methods are often accompanied by a decline in text quality, or sacrifice the randomness of LLM text generation, and there are challenges such as high false positive rate, output quality loss, and inconvenience for third-party detection.

[0053] This application determines whether the initial text can be embedded with a signature based on the initial text length, preset text length, and preset signature length corresponding to the initial text. If so, a target text embedded with a watermark is generated based on the prompt text, and then the target signature is extracted from the target text, and the target text is watermarked according to the preset text length, preset signature length, target signature, and the private key of a single detector. When the initial text can be embedded with a signature, this application generates a target text embedded with a watermark based on the prompt text, and performs watermark detection on the target text based on the preset text length, preset signature length, target signature, and the private key of a single detector, which can allow a specified single detector to detect text watermarks, that is, except for these specified detectors, other ordinary users will not be able to detect text watermarks, thereby effectively performing text watermark detection.

[0054] It should be noted that the execution subject of this application can be a computing service device with data processing, network communication and program running functions, such as a computer, etc., or an electronic device that can realize the above functions, a single detector watermark detection device, etc. The following takes a single detector watermark detection device as an example to illustrate this embodiment and the following embodiments. This application can be applied to machine translation, code generation, medical and other fields, and is used for watermark detection of text output by a large language model.

[0055] Based on this, the present application embodiment provides a watermark detection method with a single detector, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the watermark detection method of the single detector of the present application.

[0056] In this embodiment, the watermark detection method with a single detector comprises the following steps:

[0057] Step S10: judging whether the initial text can be embedded with a signature according to the initial text length, the preset text length and the preset signature length corresponding to the initial text.

[0058] It should be understood that this embodiment proposes a single designated detector watermark technology (DDW) suitable for a large language model (LLM). This technology has the following significant features: (i) When generating text, the watermark is automatically embedded in the output text; (ii) Only a specific single designated detector can recognize the watermark of the output text; (iii) For ordinary users (non-specific designated detectors), they cannot recognize the watermark. Furthermore, they will not perceive any degradation in the quality of the output text, that is, there is no obvious difference in quality between the output text with the watermark and the normal output text without the watermark. (iv) This technical solution does not rely on a specific large language model. The only assumption is that the text output by the large language model has a certain minimum entropy (that is, the output text has sufficient randomness to ensure that the watermark can be successfully embedded).

[0059] It is understandable that this embodiment proposes a designated detector watermarking scheme based on the designated verifier signature (DVS), which enables the model provider to claim ownership of the LLM output in the designated detector environment, and the detection can only be completed by a specific single designated detector. The generation of this watermarking scheme can be regarded as a DVS signature nested outside the LLM, and the structure of the LLM itself will not be modified. DDW can regard LLM as a black box, so the detection process will not access the inside of the LLM, so no additional configuration is required. In DDW, three roles are involved: model provider, designated detector, and user. The model provider is the person who provides LLM services to the user and executes the watermarking scheme in the text generation stage. The designated detector is responsible for detecting whether certain text is output by the model (by extracting and verifying the watermark). The user is the person who uses the model.

[0060] In the specific implementation, DDW mainly includes the following functions: 1) :Input security parameter λ, output algorithm output public parameter ; 2) : Enter common parameters , the watermark generation key generation algorithm outputs the signer's public key and secret key ; 3) : Enter common parameters , the detection watermark key generation algorithm outputs the verifier's public key and secret key ; 4): : Enter common parameters , watermark generates private key , specify the detector public key and prompt words , the watermark generation algorithm outputs the watermarked text ; 5) : Enter common parameters , watermark generates public key , specify the private key of the detector and text , the detection algorithm outputs a bit ; =1 (accepted, i.e. watermark verification successful) or =0 (indicates rejection, i.e. watermark authentication failed).

[0061] Specifically, The initialization function calls the initialization function of DVS to obtain a common parameter . , then output the common parameters . It is the public and private key generation algorithm for watermark generation, calling the DVS signer key generation algorithm. , and finally return . It is the public and private key generation algorithm for watermark detection, calling the DVS verifier key generation algorithm. , and finally return .

[0062] In this embodiment, The model watermarking algorithm is called by the model provider, which takes public parameters , the model provider's secret watermark key , specify the public key of the detector and a prompt word As the initial input, output the target text embedded with watermark Specifically, first initialize the relevant keys and initialize the output text If it is empty, the initial text is obtained, and the initial text length and preset text length corresponding to the initial text are calculated. And the preset signature length Determine the initial text Can the signature be embedded? , n is the preset threshold, then the initial text is determined Able to embed signature, if the above formula is not satisfied, the initial text is determined Signatures cannot be embedded.

[0063] Step S20: If yes, generate a target text with embedded watermark according to the prompt text.

[0064] It is understandable that when the initial text can be embedded with a signature, a target text embedded with a watermark can be generated based on the initial text.

[0065] Step S30: extracting a target signature from the target text, and performing watermark detection on the target text according to the preset text length, the preset signature length, the target signature and the private key of the single detector.

[0066] It should be understood that The model watermark detection algorithm is called by the model provider, which takes public parameters , the public key of the model provider , the private key of the specified single detector and target text As initial input, from the target text Extract the target signature and output a bit The target text is watermarked by the value of b. When b=0, it is determined that there is no watermark in the target text; when b=1, it is determined that there is a watermark in the target text.

[0067] This embodiment determines whether the initial text can be embedded with a signature based on the initial text length, preset text length, and preset signature length corresponding to the initial text. If so, a target text embedded with a watermark is generated based on the prompt text, and then a target signature is extracted from the target text, and the target text is watermarked based on the preset text length, preset signature length, target signature, and the private key of a single detector. This embodiment generates a target text embedded with a watermark based on the prompt text when the initial text can be embedded with a signature, and performs watermark detection on the target text based on the preset text length, preset signature length, target signature, and the private key of a single detector, which allows a specified single detector to detect a text watermark, that is, except for these specified detectors, other ordinary users will not be able to detect the text watermark, thereby effectively performing text watermark detection.

[0068] refer to Figure 2 , Figure 2 This is a flow chart of the second embodiment of the watermark detection method of the single detector of the present application.

[0069] Based on the above first embodiment, in this embodiment, step S20 includes:

[0070] Step S201: If yes, the prompt text is input into the large language model to obtain an initial output text with a text length equal to the preset text length.

[0071] Understandably, referring to Figure 3 , Figure 3 This is a schematic diagram of the process of watermark generation in an embodiment of the watermark detection method of the single detector of the present application. Figure 3 As shown, first initialize the relevant keys and initialize Is empty, then judge Is it true, that is, whether a DVS signature can be embedded? If so, the prompt text is input into the large language model to obtain the initial output text with a text length of the preset text length, that is, calling LLM to generate a length of The initial output text of .

[0072] In specific implementations, large language models (LLMs), such as GPT-3 (Generative Pre-trained Transformer 3), rely on autoregressive generation mechanisms for text generation. When generating text, autoregressive models use previously generated text as context to predict the next word or subword. LLMs learn the rich characteristics of language through pre-training on large-scale datasets, and capture long-range dependencies in text through a multi-layer model parameter structure to generate grammatically and semantically coherent text. In text generation tasks, LLMs usually use an autoregressive approach, that is, generating a word at each time step and using previously generated words as input until the end tag is generated, for example ( <eos>), etc. The relevant calculation process is as follows:

[0073] i) Self-attention mechanism: The self-attention mechanism calculates the relationship between each word in the input sequence and other words by weighted summation. Given an input sequence X, generate a key matrix K, a query matrix Q, and a value matrix Q=X\cdot W_Q, K=X\cdotW_K, V=X\cdot W_V, where , , is a trainable weight matrix.

[0074] ii) Attention score: The attention score is calculated by dot product and applied Function: Attention(Q,K,V)=softmax\left(\frac{Q\cdot K^T}{\sqrt{d_k}}\right)\cdot V. Where d_k is the dimension of the key matrix.

[0075] iii) Output calculation: Multiply the attention score with the value vector to get the representation of each word, which is then transformed through a linear layer and an activation function to get the final output sequence.

[0076] Take the most common sentence "Hello World!" in the computer field as an example. When we input "Hello" into the large language model LLM and prompt it to output the next word that is most likely to appear in the computer field, after the calculation of the three processes i), ii), and iii), the most likely output of LLM is: "World!", that is, LLM ("Please give the next word of Hello in the computer field", max_new_tokens=1) → "World!".

[0077] Based on the above description of LLM functions, a packaging method for the LLM function is given: It is a text generation algorithm. The input parameters are LLM model (can be any language model), prompt text And the length of the word generated text The specific operation process is Enter the LLM service for the prompt word to generate text, and return the length Output , that is, LLM(p,x)\rightarrow t, , and finally Output as a return value. In particular, It can be understood as the actual length of the output text, or the number of words or characters in the output text. It only needs to ensure that the text generated each time can be restored when the final generated text is reversely disassembled. In the entire DDW framework, a text generation task should maintain Always consistent.

[0078] Step S202: Sign the initial output text and determine whether the generated initial signature is empty.

[0079] It should be understood that DVS can be called to sign the initial output text. A DVS scheme contains 5 algorithms, DVS= (Setup, SignKG, VerKG, Sign, Verify), where: 1) :Input security parameter λ, output algorithm output public parameter 2) : Enter common parameters , the signature key generation algorithm outputs the signer's public key and secret key 3) : Enter common parameters , the verification key generation algorithm outputs the verifier’s public key and secret key .4) : Enter common parameters , Signature Secret Key , specify the public key of the verifier and Message , the signature algorithm outputs the signature 5) : Enter common parameters , signature public key , the validator's secret key ,information and signature , the verification algorithm outputs a bit ; (indicates acceptance, i.e. signature verification is successful) or (Indicates rejection, i.e. signature authentication failed).

[0080] Understandably, Is the initialization algorithm, input security parameters , the algorithm selects a description of a cyclic group ,in is a prime number, and They are all of the order The cyclic group of It is defined in the group Bilinear mapping function on . for The generator of the group and choose two secure hash functions and , and ,in For a Function of polynomial. Package the above parameters into a common parameter set ,Right now . and It is the public and private key generation algorithm. The steps of these two algorithms are the same, as follows: Select a random positive integer ,Right now , then calculate .remember is the private key, is the public key, output the public-private key pair . is a signature algorithm. The input parameters are public parameter sets. , the signer's private key , a public key for a designated verifier and Message The detailed steps of the entire signing process are as follows: i) First, a string is randomly selected , calculate a hash value ii) Secondly, calculate a bilinear mapping value and calculate the hash of the value ; iii) Finally, output the signature, .

[0081] In the specific implementation, through the above function Sign the initial output text and initialize and Is empty and determines the generated initial signature Whether it is empty.

[0082] Step S203: If yes, return to the step of inputting the prompt text into the large language model to obtain the initial output text until the new signature is not empty.

[0083] It is understandable that when generating the initial signature If it is empty, the process returns to the step of inputting the prompt text into the large language model to obtain the initial output text, that is, re-determining whether a DVS signature can be embedded until the new signature obtained is not empty.

[0084] Step S204: Determine the target text to be embedded with the watermark according to the new signature.

[0085] Furthermore, in order to effectively generate a target text embedded with a watermark, in this embodiment, step S204 includes: determining an initial bit value and a target signature according to the new signature, and generating a target output text with a text length of the preset text length through the large language model; judging whether the target output text and the initial bit value satisfy a first preset relationship; if not, generating a new target output text with a text length of the preset text length through the large language model, and returning to the step of judging whether the target output text and the initial bit value satisfy the preset relationship until the new target output text and the initial bit value satisfy the preset relationship; and determining a target text embedded with a watermark according to the new target output text.

[0086] It should be understood that in the new signature If not empty, you can get The first bit As the initial bit value, and let the target sign . Then the text length generated by the large language model is the preset text length The target output text is .

[0087] It is understandable that it is possible to determine whether the target output text and the initial bit value satisfy the first preset relationship, that is, to determine whether the target output text and the initial bit value satisfy the first preset relationship. Is it equal to If not, the text length is regenerated to the preset text length through the large language model LLM The new target output text is assigned to Then re-judge Is it equal to If so, calculate , t , . And return to the above "Judge whether the signature is empty".

[0088] In the specific implementation, if the signature cannot be embedded, it is determined whether the length of the output text is less than , that is, to determine whether If yes, call LLM to generate a segment of length The text of The back becomes a new , and output If not, output directly .

[0089] In addition, the above watermark generation algorithm This can be achieved through the following code, namely:

[0090] , / / Indicates empty

[0091] While do / / Indicates the bit length of a DVS signature

[0092]

[0093] / / express The End Elements

[0094] , / / Indicates empty

[0095] While do

[0096] , / / Indicates the second to last bit

[0097] x

[0098] While do / / is a hash function

[0099] x

[0100] , t

[0101]

[0102] If then

[0103]

[0104] Return

[0105] In this embodiment, when the initial text can be embedded with a signature, the prompt text is input into the large language model to obtain an initial output text with a text length equal to a preset text length, and then the initial output text is signed, and it is determined whether the generated initial signature is empty. If so, the prompt text is input into the large language model to obtain the initial output text, until the new signature is not empty, and then the target text to be embedded with the watermark is determined based on the new signature. In this embodiment, when the initial text can be embedded with a signature, it is repeatedly determined whether the generated signature is empty until it is not empty, and the target text to be embedded with the watermark can be effectively determined based on the new signature.

[0106] refer to Figure 4 , Figure 4 This is a flow chart of the third embodiment of the watermark detection method of the single detector of the present application.

[0107] Based on the above embodiments, in this embodiment, step S30 includes:

[0108] Step S301: Determine whether the first initial value, the preset text length, and the preset signature length satisfy a second preset relationship.

[0109] Understandably, The model watermark detection algorithm is called by the model provider, which takes public parameters , the public key of the model provider , specify the detector's private key and target text As initial input, output a bit .

[0110] It should be understood that reference Figure 5 , Figure 5 This is a schematic diagram of the watermark detection process of an embodiment of the watermark detection method of the single detector of the present application. Figure 5 As shown, this embodiment can initialize the relevant key and initialize the first initial value Then determine whether the first initial value, the preset text length, and the preset signature length satisfy the second preset relationship, that is, Is it true?

[0111] Step S302: If yes, a hash value is calculated according to the target text and the first initial value.

[0112] It is understandable that when the above formula is true, the hash value can be calculated .

[0113] Step S303: Determine whether the second initial value is less than or equal to the preset signature length.

[0114] It should be understood that when calculating the hash value back, , , , and then determine whether the second initial value is less than or equal to the preset signature length, that is Is it true?

[0115] In the specific implementation, if it is established, calculate , , Then return to the above loop and re-judge Is it true?

[0116] Step S304: If not, extract the target signature from the target text, and perform watermark detection on the target text according to the target signature, the private key of the single detector, and the hash value.

[0117] It is understandable that when the above formula does not hold, the target signature can be extracted from the target text , and according to the target signature , the private key of a single detector , hash value Perform watermark detection on the target text.

[0118] Furthermore, in order to effectively perform watermark detection on the target text, in this embodiment, the step S304 includes: if not, extracting the target signature from the target text, and calculating the signature verification value based on the private key of the single detector, the hash value, and the target signature; when the signature verification value is not 1, generating a new first initial value, and returning to the step of determining whether the first initial value, the preset text length, and the preset signature length satisfy the second preset relationship; if not, determining that there is no watermark in the target text.

[0119] It should be understood that when the above formula does not hold, the target signature can be extracted from the target text , and according to the private key of a single detector , hash value , target signature Calculate the signature verification value b, that is, calculate ,in , When the signature verification value is 1, it can be determined that there is a watermark in the target text.

[0120] It is understandable that when the signature verification value is not 1, the new first initial value , and returns the above judgment In the loop judgment of whether it is established, if it is not established, then output 0 and determine that there is no watermark in the target text.

[0121] In the specific implementation, the above watermark detection algorithm This can be achieved through the following code, namely:

[0122] , , / / Indicates empty

[0123] For do / / Indicates the bit length of a DVS signature

[0124] , , ,

[0125] For do

[0126]

[0127] / / is a hash function

[0128] If then

[0129] Return

[0130] Return

[0131] Furthermore, in order to accurately calculate the signature verification value, in this embodiment, the step of calculating the signature verification value based on the private key of the single detector, the hash value, and the target signature specifically includes: extracting the variables in the target signature to obtain a first variable and a second variable; calculating the target hash value based on the first variable and the hash value; when the equation formed by the second variable, the target hash value, the private key of the single detector, and the public key of the model provider holds, determining that the signature verification value is 1.

[0132] Understandably, It is a signature verification algorithm. The input parameters are the public parameter set , the signer's private key , a public key for a designated verifier and target signature ,in , Specifically, first, extract the target signature Variables in , The first variable, The second variable and calculate a target hash value Secondly, judge Is it true? If true, return , otherwise return .

[0133] This embodiment determines whether the first initial value, the preset text length, and the preset signature length satisfy the second preset relationship. If so, a hash value is calculated based on the target text and the first initial value, and then it is determined whether the second initial value is less than or equal to the preset signature length. If not, a target signature is extracted from the target text, and a watermark detection is performed on the target text based on the target signature, the private key of the single detector, and the hash value. This embodiment first calculates a hash value based on the target text and the first initial value, and performs watermark detection on the target text based on the extracted target signature, the private key of the single detector, and the hash value, so that watermark detection can be effectively performed on the target text.

[0134] Reference Figure 6 , Figure 6 This is a structural block diagram of the first embodiment of the watermark detection device of the single detector of the present application.

[0135] like Figure 6 As shown, the watermark detection device with a single detector proposed in the embodiment of the present application includes:

[0136] A signature judgment module 10, used to judge whether the initial text can be embedded with a signature according to the initial text length, the preset text length and the preset signature length corresponding to the initial text;

[0137] A text generation module 20, used to generate a target text for embedding a watermark according to the prompt text when the initial text can be embedded with a signature;

[0138] The watermark detection module 30 is used to extract the target signature from the target text and perform watermark detection on the target text according to the preset text length, the preset signature length, the target signature and the private key of the single detector.

[0139] This embodiment determines whether the initial text can be embedded with a signature based on the initial text length, preset text length, and preset signature length corresponding to the initial text. If so, a target text embedded with a watermark is generated based on the prompt text, and then a target signature is extracted from the target text, and the target text is watermarked based on the preset text length, preset signature length, target signature, and the private key of a single detector. This embodiment generates a target text embedded with a watermark based on the prompt text when the initial text can be embedded with a signature, and performs watermark detection on the target text based on the preset text length, preset signature length, target signature, and the private key of a single detector, which allows a specified single detector to detect a text watermark, that is, except for these specified detectors, other ordinary users will not be able to detect the text watermark, thereby effectively performing text watermark detection.

[0140] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present application. In practical applications, technicians in this field can select part or all of it according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.

[0141] In addition, for technical details not described in detail in this embodiment, please refer to the watermark detection method of a single detector provided in any embodiment of the present application, and will not be repeated here.

[0142] Based on the first embodiment of the watermark detection device with a single detector of the present application, a second embodiment of the watermark detection device with a single detector of the present application is proposed.

[0143] In this embodiment, the text generation module 20 is also used to input the prompt text into the large language model when the initial text can be embedded with a signature, to obtain an initial output text with a text length equal to the preset text length; to sign the initial output text, and to determine whether the generated initial signature is empty; if so, to return to the step of inputting the prompt text into the large language model to obtain the initial output text until the new signature is not empty; and to determine the target text for embedding the watermark according to the new signature.

[0144] Furthermore, the text generation module 20 is also used to determine the initial bit value and the target signature according to the new signature, and generate a target output text with a text length of the preset text length through the large language model; determine whether the target output text and the initial bit value satisfy a first preset relationship; if not, generate a new target output text with a text length of the preset text length through the large language model, and return to the step of determining whether the target output text and the initial bit value satisfy the preset relationship until the new target output text and the initial bit value satisfy the preset relationship; determine the target text for embedding the watermark according to the new target output text.

[0145] Furthermore, the watermark detection module 30 is also used to determine whether the first initial value, the preset text length and the preset signature length satisfy a second preset relationship; if so, calculate a hash value based on the target text and the first initial value; determine whether the second initial value is less than or equal to the preset signature length; if not, extract the target signature from the target text, and perform watermark detection on the target text based on the target signature, the private key of the single detector, and the hash value.

[0146] Furthermore, the watermark detection module 30 is also used to extract the target signature from the target text when the second initial value is less than or equal to the preset signature length, and calculate the signature verification value based on the private key of the single detector, the hash value, and the target signature; when the signature verification value is not 1, generate a new first initial value, and return to the step of determining whether the first initial value, the preset text length, and the preset signature length satisfy the second preset relationship; if not, determine that there is no watermark in the target text.

[0147] Furthermore, the watermark detection module 30 is also used to extract the variables in the target signature to obtain a first variable and a second variable; calculate the target hash value based on the first variable and the hash value; and determine that the signature verification value is 1 when the equation consisting of the second variable, the target hash value, the private key of the single detector and the public key of the model provider holds.

[0148] Other embodiments or specific implementation methods of the watermark detection device of the single detector of the present application can refer to the above-mentioned method embodiments and will not be repeated here.

[0149] The present application provides a single-detector watermark detection device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the single-detector watermark detection method in the above-mentioned embodiment 1.

[0150] Reference below Figure 7 , which shows a schematic diagram of the structure of a watermark detection device with a single detector suitable for implementing an embodiment of the present application. The watermark detection device with a single detector in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 7 The single-detector watermark detection device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0151] like Figure 7 As shown, the watermark detection device with a single detector may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the watermark detection device with a single detector are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the watermark detection device with a single detector to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a watermark detection device with a single detector having various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have instead.

[0152] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0153] The single-detector watermark detection device provided by the present application adopts the single-detector watermark detection method in the above embodiment, which can solve the technical problem of how to effectively perform text watermark detection when a single detector is specified. Compared with the prior art, the beneficial effects of the single-detector watermark detection device provided by the present application are the same as the beneficial effects of the single-detector watermark detection method provided by the above embodiment, and other technical features in the single-detector watermark detection device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.

[0154] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0155] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

[0156] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the watermark detection method of the single detector in the above-mentioned embodiment.

[0157] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0158] The computer-readable storage medium may be included in a watermark detection device with a single detector; or may exist independently without being assembled into a watermark detection device with a single detector.

[0159] The above-mentioned computer-readable storage medium carries one or more programs. When the above-mentioned one or more programs are executed by the watermark detection device of a single detector, the watermark detection device of the single detector enables the following: to determine whether the initial text can be embedded with a signature based on the initial text length, the preset text length and the preset signature length corresponding to the initial text; if so, to generate a target text embedded with a watermark based on the prompt text; to extract a target signature from the target text, and to perform watermark detection on the target text based on the preset text length, the preset signature length, the target signature and the private key of the single detector.

[0160] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0161] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0162] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0163] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the watermark detection method using a single detector, and can solve the technical problem of how to effectively perform text watermark detection when a single detector is specified. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as those of the watermark detection method using a single detector provided by the above embodiment, and will not be elaborated on here.

[0164] The present application also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the watermark detection method of the single detector as described above are implemented.

[0165] The computer program product provided by the present application can solve the technical problem of how to effectively perform text watermark detection when a single detector is specified. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the watermark detection method with a single detector provided in the above embodiment, and will not be described in detail here.

[0166] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.< / eos>

Claims

1. A watermark detection method using a single detector, characterized in that: The watermark detection method with a single detector comprises the following steps: Determining whether the initial text can be embedded with a signature based on the initial text length, the preset text length, and the preset signature length corresponding to the initial text; If yes, then generate the target text embedded with watermark according to the prompt text; Extracting a target signature from the target text, and performing watermark detection on the target text according to the preset text length, the preset signature length, the target signature, and a private key of a single detector; If so, the step of generating a target text embedded with a watermark according to the prompt text specifically includes: If yes, the prompt text is input into the large language model to obtain an initial output text with a text length equal to the preset text length; Signing the initial output text, and determining whether the generated initial signature is empty; If yes, return to the step of inputting the prompt text into the large language model to obtain the initial output text until the new signature is not empty; Determine the target text to embed the watermark according to the new signature; The step of determining the target text for embedding the watermark according to the new signature specifically comprises: Determine an initial bit value and a target signature according to the new signature, and generate a target output text with a text length of the preset text length through the large language model; Determining whether the target output text and the initial bit value satisfy a first preset relationship; If not, a new target output text having a text length equal to the preset text length is generated by the large language model, and the step of determining whether the target output text and the initial bit value satisfy a preset relationship is returned to until the new target output text and the initial bit value satisfy the preset relationship; The target text for embedding the watermark is determined according to the new target output text.

2. The watermark detection method of a single detector as claimed in claim 1, characterized in that: The step of extracting the target signature from the target text and performing watermark detection on the target text according to the preset text length, the preset signature length, the target signature and the private key of the single detector specifically includes: Determining whether the first initial value, the preset text length, and the preset signature length satisfy a second preset relationship; If yes, a hash value is calculated based on the target text and the first initial value; Determining whether the second initial value is less than or equal to the preset signature length; If not, extract the target signature from the target text, and perform watermark detection on the target text according to the target signature, the private key of the single detector, and the hash value.

3. The watermark detection method of a single detector as claimed in claim 2, characterized in that: If not, extracting the target signature from the target text, and performing watermark detection on the target text according to the target signature, the private key of the single detector, and the hash value, specifically includes: If not, extracting the target signature from the target text, and calculating the signature verification value according to the private key of the single detector, the hash value, and the target signature; When the signature verification value is not 1, generating a new first initial value, and returning to the step of determining whether the first initial value, the preset text length, and the preset signature length satisfy a second preset relationship; If not, it is determined that there is no watermark in the target text.

4. The watermark detection method of a single detector as claimed in claim 3, characterized in that: The step of calculating the signature verification value according to the private key of the single detector, the hash value, and the target signature specifically includes: Extracting variables in the target signature to obtain a first variable and a second variable; Calculate a target hash value according to the first variable and the hash value; When an equation consisting of the second variable, the target hash value, the private key of the single detector, and the public key of the model provider holds true, the signature verification value is determined to be 1.

5. A watermark detection device with a single detector, characterized in that: The single detector watermark detection device comprises: A signature judgment module, used to judge whether the initial text can be embedded with a signature according to the initial text length, the preset text length and the preset signature length corresponding to the initial text; A text generation module, used to generate a target text for embedding a watermark according to the prompt text when the initial text can be embedded with a signature; A watermark detection module, used to extract a target signature from the target text, and perform watermark detection on the target text according to the preset text length, the preset signature length, the target signature and a private key of a single detector; The text generation module is further configured to, when the initial text can be embedded with a signature, input the prompt text into the large language model to obtain an initial output text whose text length is the preset text length; sign the initial output text, and determine whether the generated initial signature is empty; if so, return to the step of inputting the prompt text into the large language model to obtain the initial output text until the new signature is not empty; and determine the target text for embedding the watermark according to the new signature; The text generation module is further used to determine the initial bit value and the target signature according to the new signature, and generate a target output text with a text length of the preset text length through the large language model; determine whether the target output text and the initial bit value satisfy a first preset relationship; if not, generate a new target output text with a text length of the preset text length through the large language model, and return to the step of determining whether the target output text and the initial bit value satisfy the preset relationship until the new target output text and the initial bit value satisfy the preset relationship; determine the target text for embedding the watermark according to the new target output text.

6. A single detector watermark detection device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the watermark detection method of the single detector according to any one of claims 1 to 4.

7. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the watermark detection method of a single detector according to any one of claims 1 to 4 are implemented.

8. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the watermark detection method of a single detector according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Method for embedding and detecting digital watermark in large language model generated text

    CN117272253A

  • Text watermark adding method and device, storage medium and electronic equipment

    CN118378229A