Generating text detection methods and related devices
By introducing lexical cohesive features into the zero-shot detector, the generated text detection method is improved, which solves the problem of poor detection performance in the existing technology and achieves more efficient text type differentiation.
Patent Information
- Application Number
- CN202411100864.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-12
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2044-08-12
AI Technical Summary
Existing text generation detection schemes extract only single features and have unsatisfactory detection results. In particular, traditional zero-shot detectors cannot effectively capture the lexical cohesion differences in text generated by language models.
By introducing lexical cohesion as a new statistical feature, and combining the lexical cohesion calculation model with the basic detection model, a dual-channel detection paradigm is formed, which improves the zero-sample detector and enhances detection accuracy.
By combining lexical cohesive features, the accuracy and effectiveness of generated text detection are significantly improved, enabling a more precise distinction between text generated by language models and text written by humans.
Smart Images

Figure CN119227689B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] One or more embodiments of the present application relate to the technical field of natural language processing, and in particular to a method for detecting generated text and related equipment. BACKGROUND
[0002] Large Language Models (LLMs) refer to machine learning models with large-scale parameters and complex computational structures. These models are usually built by deep neural networks with tens of billions or even hundreds of billions of parameters, which learn complex models and features through training massive data, have stronger generalization ability, and can make accurate predictions on unseen data. The purpose of designing large models is to improve the expression ability and prediction performance of the model, which can handle more complex tasks and data.
[0003] With the development of machine learning technology and its application in various fields, the ability and efficiency of large language models (LLMs) applied in the field of natural language processing are remarkable. Among them, through large language models, text similar to that written by humans can be generated.
[0004] The improvement of this ability has also raised concerns about its misuse. Therefore, effective detection of large language model generated text has become an important principle to ensure that large language models are used responsibly.
[0005] However, the detection scheme in the related art still has the problem of single feature extraction and unsatisfactory detection effect. SUMMARY
[0006] Therefore, one or more embodiments of the present application aim to provide a method for detecting generated text and related equipment to solve the problems raised in the background art.
[0007] To achieve the above purpose, one or more embodiments of the present application provide a method for detecting generated text. The method comprises:
[0008] obtaining a text to be detected;
[0009] According to the text to be detected, obtaining the word token cohesion of the text to be detected, the word token cohesion representing the semantic closeness between each word in the text to be detected;
[0010] According to the text to be detected, obtaining an original prediction value through a basic detection model;
[0011] According to the original prediction value and the word token cohesion, obtaining a final detection result.
[0012] Optionally, the method further comprises:
[0013] According to the to-be-detected text, a plurality of to-be-detected text copies are created, the to-be-detected text copies including partial content of the to-be-detected text;
[0014] According to the to-be-detected text and the to-be-detected text copies, a word piece cohesion calculation model is used to obtain word piece cohesion of the to-be-detected text.
[0015] Optionally, the word piece cohesion calculation model includes:
[0016] wherein x represents the to-be-detected text, represents the to-be-detected text copy, n represents a quantity of the to-be-detected text copies.
[0017] Optionally, the base detection model is trained based on a zero-shot detector.
[0018] Optionally, the final detection result is obtained according to the original prediction value and the word piece cohesion, including:
[0019] According to the original prediction value and the word piece cohesion, a final prediction value is obtained by the following formula:
[0020] w(x)=e u(x) ×v(x);
[0021] wherein u(x) represents the word piece cohesion of the to-be-detected text, and v(x) represents the original prediction value of the to-be-detected text.
[0022] According to the final prediction value, it is determined whether the to-be-detected text is generated text.
[0023] Optionally, the final prediction value is used to determine whether the to-be-detected text is generated text, including:
[0024] In response to the final prediction value being greater than a preset threshold, it is determined that the to-be-detected text is generated text.
[0025] In response to the final prediction value being less than or equal to a preset threshold, it is determined that the to-be-detected text is not generated text.
[0026] Optionally, the word piece cohesion of the to-be-detected text is obtained by a word piece cohesion calculation model, including:
[0027] The word piece cohesion calculation model is invoked by performing a preset operation, so that the word piece cohesion calculation model provides a calculation service in a preset manner.
[0028] Based on the same inventive concept, one or more embodiments of the present application further provide a text generation device, comprising:
[0029] an acquisition module configured to acquire a text to be detected;
[0030] a first calculation module configured to obtain, according to the text to be detected, a word unit cohesion of the text to be detected, the word unit cohesion representing a semantic closeness between words in the text to be detected;
[0031] a second calculation module configured to obtain, according to the text to be detected, an original prediction value through a basic detection model;
[0032] a third calculation module configured to obtain a final detection result according to the original prediction value and the word unit cohesion.
[0033] Based on the same inventive concept, one or more embodiments of the present application further provide an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the text generation method according to any one of the above embodiments when executing the program.
[0034] Based on the same inventive concept, one or more embodiments of the present application further provide a non-transitory computer readable storage medium, which stores computer instructions for causing the computer to execute the text generation method according to any one of the above embodiments.
[0035] As can be seen from the above, the text generation method according to one or more embodiments of the present application comprises the following steps: acquiring a text to be detected; obtaining, according to the text to be detected, a word unit cohesion of the text to be detected, the word unit cohesion representing a semantic closeness between words in the text to be detected; obtaining, according to the text to be detected, an original prediction value through a basic detection model; and obtaining a final detection result according to the original prediction value and the word unit cohesion.
[0036] The technical solution of the present application combines the word unit cohesion feature of the text to be detected and the basic detection result to detect the text to be detected, thereby improving the text generation detection effect.
[0037] The text generation device, the electronic device, and the computer readable storage medium provided by the present application can all implement the steps of the above text generation method, and therefore have the same beneficial effects as the above text generation method. BRIEF DESCRIPTION OF DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the one or more embodiments of the present application or the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced. Obviously, the drawings in the following description only constitute a part of the one or more embodiments of the present application, and other drawings can be obtained by those skilled in the art without any creative effort on the basis of these drawings.
[0039] Figure 1 A flowchart of a text generation detection method according to one or more embodiments of the present application;
[0040] Figure 2 A structural diagram of a text generation detection model according to one or more embodiments of the present application;
[0041] Figure 3 A word token cohesion experiment result diagram according to one or more embodiments of the present application;
[0042] Figure 4 A text generation judgment process pseudocode diagram according to one or more embodiments of the present application;
[0043] Figure 5 An electronic device hardware structure diagram according to one or more embodiments of the present application. DETAILED DESCRIPTION
[0044] In order to make the objects, technical solutions and advantages of the present disclosure clearer, the present disclosure will be further described in detail below with reference to the drawings and in conjunction with specific embodiments.
[0045] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the one or more embodiments of the present application should be understood as the general meaning understood by those skilled in the art to which the present disclosure belongs. The terms "first", "second" and the like used in the one or more embodiments of the present application do not represent any order, number or importance, but are only used to distinguish different components. The terms "include" or "contain" and the like mean that the elements or objects before the terms cover the elements or objects listed after the terms and their equivalents, without excluding other elements or objects. The terms "connect" or "connected" and the like do not mean physical or mechanical connection, but can include electrical connection, whether direct or indirect. The terms "up", "down", "left", "right" and the like only represent relative positional relationships, which can change accordingly when the absolute positions of the described objects change.
[0046] As described in the background section, the detection of generated text can be regarded as a binary classification task, i.e., classifying the text to be detected as generated text generated by a large language model or text written by a human.
[0047] In the related art, the above tasks are mainly performed by supervised learning detectors or zero-shot detectors.
[0048] In the first type of solution, a supervised learning detector is usually used to train using statistical features or neural representations of the data according to artificially annotated data to distinguish between text generated by a large language model and text written by a human. One popular trend is to directly fine-tune a pre-trained language model, i.e., to add a unit for classification to the pre-trained model to make the pre-trained model have the function of classifying text, such as BERT or RoBERTa, for the classification task of text. However, the supervised learning detector is trained by learning the differences between the text generated by the large language model and the text written by the human in the annotated data, and thus is prone to overfitting to a specific training field and may have poor generalization ability, and also needs to be retrained regularly.
[0049] In the second type of related art, zero-shot detectors do not need to be trained and usually show better generalization ability. The core idea is to extract various statistical features, such as log-likelihood, perplexity, normalized log-rank perturbation, probability and conditional probability curvature, and threshold these features to distinguish between text generated by a large language model and text written by a human. These features can be collected from the source large language model itself (white-box setting) or a proxy model (black-box setting). In addition, some black-box zero-shot detectors based on large language model rewriting have appeared in the related art. The core idea of these methods is to use another large language model (usually ChatGPT) to rewrite the text passage, and then evaluate the similarity or overlap between the original text and the rewritten text. The passage with greater similarity or overlap will be considered as generated by a large language model.
[0050] Zero-shot detectors extract diverse features that distinguish between the two types of text and directly threshold these features without training, so they are less susceptible to domain-specific factors and usually have better generalization ability. However, traditional zero-shot detectors often only extract a single statistical feature. On the one hand, the Transformer-based language model consistently uses the "causal self-attention mechanism" when generating text, making the generation of each word closely related to the words before it, resulting in higher word cohesion in language model-generated text. This meaningful difference for text detection cannot be captured using traditional zero-shot methods, resulting in information loss.
[0051] The applicant found in the process of implementing the present disclosure that language model-generated samples usually exhibit higher word coherence than artificially written text. Combining the feature of word coherence can effectively improve the effectiveness of the detection result.
[0052] Therefore, the application provides a text generation detection method to solve the above problems.
[0053] Reference Figure 1 The text generation detection method of one or more embodiments of the application comprises the following steps:
[0054] Step S101: obtaining a text to be detected.
[0055] The above text represents a sentence, paragraph or chapter composed of word pieces.
[0056] Step S102: obtaining word piece cohesion of the above text to be detected according to the above text to be detected, the word piece cohesion representing the semantic closeness between each word in the text to be detected.
[0057] In the implementation of the application, the applicant found that for the text generated by the language model, each word is generated based on all its previous words, which naturally promotes the close relationship between the words, resulting in higher cohesion. However, for the text written by hand, there is no such explicit restriction to generate words, which may result in a loose relationship between the words, resulting in lower cohesion. Therefore, the applicant proposes the hypothesis that "samples generated by language models usually exhibit higher word piece cohesion than texts written by hand".
[0058] Based on this hypothesis, the applicant has made the following verification work:
[0059] Let P LLM represent the distribution of language model generated text, P Human represent the distribution of manually written text. Based on the above assumption, the word piece cohesion u(x) is usually higher in the sample x~P LLM , and usually lower in the sample x~P Human .
[0060] The applicant has empirically verified this hypothesis through an automated method. Specifically, the applicant randomly selects 500 news articles as manually written data, and uses four different language models to generate "language model generated text" based on the condition that the first 30 words of each manually written article are prompted. For each original text, 10 copies are created, and 1.5% of the words of the original text are randomly deleted in each copy. Then use negative BARTScore as semantic difference measure DIFF(·,·), and use the average of the 10 copies to approximate the expectation E(·). Figure 3 The experimental results are shown, which show that the word piece cohesion distribution of language model generated text and manually written text is significantly different. Language model generated samples indeed tend to have higher word piece cohesion.
[0061] Thus, the present application proposes a new statistical feature for zero-shot text detection, namely, word token cohesion, and combines it with traditional zero-shot detectors, so that the traditional detectors can additionally consider the semantic dimension features to more accurately detect language model generated texts.
[0062] In some embodiments, a semantic similarity measurement model such as BARTScore can be used to calculate the word token cohesion of a candidate paragraph. This model is relatively small and can be used directly without any fine-tuning.
[0063] In some embodiments, the word token cohesion can be defined as follows: given a candidate text x, let denote a copy of the candidate text created by randomly deleting a small number of words from x, and let the expected value of the semantic difference between x and x' is the word token cohesion of the candidate text x. The word token cohesion essentially measures the semantic closeness between words in a paragraph. The more closely related the semantic relationship between words, the higher the word token cohesion.
[0064] Thus, in some embodiments of the present application, the word token cohesion of the text to be detected can be calculated by the formula where x represents the text to be detected, x' represents a copy of the text to be detected, and n represents the number of copies of the text to be detected.
[0065] In some embodiments, the above word token cohesion is obtained through a word token cohesion calculation model. The above word token cohesion calculation model can be used as a pluggable module to improve the basic detection model. For example, LRR and Fast-DetectGPT can be selected as the basic detection model, and the word token cohesion calculation model can be applied to the detector as a pluggable module.
[0066] Step S103: According to the above text to be detected, an original prediction value is obtained through a basic detection model.
[0067] In some embodiments, the above basic detection model can be trained based on a zero-shot detector.
[0068] In some embodiments, the above text to be detected is first input into a first channel, which creates a copy of the text to be detected based on the above text to be detected and calculates the word token cohesion; then the above text to be detected is input into a second channel, which obtains an original prediction value through a basic detection model.
[0069] Step S104: According to the above original prediction value and the above word token cohesion, a final detection result is obtained.
[0070] In some embodiments, a final prediction value can be obtained by the formula w(x) = e u(x) xv(x) based on the calculation results of the above two steps, where u(x) represents the word token cohesion of the text to be detected, and v(x) represents the original prediction value of the text to be detected; and then, whether the text to be detected is a generated text is determined according to the final prediction value.
[0071] In some embodiments, in response to the final prediction value being greater than a preset threshold, it is determined that the text to be detected is a generated text; and in response to the final prediction value being less than or equal to the preset threshold, it is determined that the text to be detected is not a generated text.
[0072] In some embodiments, the pseudo code of the above determination process is as shown in Figure 4
[0073] According to the above content, the present application proposes the concept of word token cohesion, and discloses that it can be used as a new standard for distinguishing between language model generated texts and human written texts. Based on this new finding, the present application designs a detection device with the structure of a "basic detection model + word token cohesion calculation model". The device is a general two-channel detection paradigm, uses word token cohesion as a pluggable module, and improves the existing zero-shot detector without changing the structure of the original detector and without the need for additional training, only a small additional time and space cost is needed to improve the detection accuracy of the original detector.
[0074] It can be understood that the method can be executed by any device, equipment, platform, device cluster with computing and processing capability.
[0075] It should be noted that the method of one or more embodiments of the present application can be executed by a single device, such as a computer or a server, etc. The method of the present embodiment can also be applied to a distributed scenario, and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only execute one or more steps in the method of one or more embodiments of the present application, and the multiple devices will interact with each other to complete the method.
[0076] It should be noted that the above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be executed in an order different from that in the embodiments and still achieve the desired result. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown or described to achieve the desired results. In some embodiments, multitasking and parallel processing can be possible or advantageous.
[0077] Corresponding to the method of any of the above embodiments, the application further provides a text generation detection device based on the same inventive concept.
[0078] As shown in Figure 2 the text generation detection device comprises:
[0079] An acquisition module 11 configured to acquire a text to be detected;
[0080] A first calculation module 12 configured to obtain a word token cohesion of the text to be detected according to the text to be detected, the word token cohesion representing a semantic closeness between words in the text to be detected;
[0081] A second calculation module 13 configured to obtain an original prediction value by a basic detection model according to the text to be detected;
[0082] A third calculation module 14 configured to obtain a final detection result according to the original prediction value and the word token cohesion.
[0083] Optionally, the obtaining of the word token cohesion of the text to be detected according to the text to be detected comprises:
[0084] creating a plurality of text copies to be detected according to the text to be detected, the text copies to be detected comprising partial content of the text to be detected;
[0085] obtaining the word token cohesion of the text to be detected by a word token cohesion calculation model according to the text to be detected and the text copies to be detected.
[0086] Optionally, the word token cohesion calculation model comprises:
[0087] wherein x represents the text to be detected, represents the text copies to be detected, n represents a number of the text copies to be detected.
[0088] Optionally, the basic detection model is obtained based on a zero-shot detector.
[0089] Optionally, the obtaining of the final detection result according to the original prediction value and the word token cohesion comprises:
[0090] obtaining a final prediction value according to the original prediction value and the word token cohesion by the following formula:
[0091] w(x)=e u(x) ×v(x);
[0092] Wherein, u(x) represents the word token cohesion of the text to be detected, and v(x) represents the original prediction value of the text to be detected.
[0093] According to the final prediction value, it is determined whether the text to be detected is a generated text.
[0094] Optionally, according to the final prediction value, it is determined whether the text to be detected is a generated text, comprising:
[0095] In response to the final prediction value being greater than a preset threshold, it is determined that the text to be detected is a generated text.
[0096] In response to the final prediction value being less than or equal to a preset threshold, it is determined that the text to be detected is not a generated text.
[0097] Optionally, the word token cohesion of the text to be detected is obtained through a word token cohesion calculation model, comprising:
[0098] The word token cohesion calculation model is called through performing a preset operation, so that the word token cohesion calculation model provides a calculation service in a preset manner.
[0099] For the convenience of description, the above device is described as various modules described respectively in terms of functions. Of course, when implementing one or more embodiments of the present application, the functions of each module can be implemented in one or more software and / or hardware.
[0100] The device of the above embodiment is used to implement the corresponding method in the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be described here.
[0101] Figure 5 A more specific electronic device hardware structure schematic diagram provided by the embodiment is shown, which can include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 for communication within the device.
[0102] The processor 1010 can be implemented in the form of a general-purpose CPU (Central Processing Unit, central processor), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., for executing related programs to implement the technical solutions provided by the embodiments of the present application.
[0103] The memory 1020 can be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, etc. The memory 1020 can store an operating system and other application programs, and when the technical solutions provided in the embodiments of the present application are implemented by software or firmware, the related program codes are stored in the memory 1020 and are called and executed by the processor 1010.
[0104] The input / output interface 1030 is configured to connect an input / output module to realize information input and output. The input / output module can be configured in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. The input device can include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device can include a display, a speaker, a vibrator, an indicator light, etc.
[0105] The communication interface 1040 is configured to connect a communication module (not shown in the figure) to realize the communication interaction between the device and other devices. The communication module can realize communication through a wired manner (such as USB, network cable, etc.) or through a wireless manner (such as mobile network, WIFI, Bluetooth, etc.).
[0106] The bus 1050 includes a channel to transmit information between various components (such as the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040) of the device.
[0107] It should be noted that although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040, and the bus 1050, in the specific implementation process, the device can also include other components necessary for normal operation. In addition, those skilled in the art can understand that the above device can also only contain the components necessary to implement the embodiments of the present application, and does not have to contain all the components shown in the figure.
[0108] The electronic device of the above embodiments is used to implement the corresponding method in the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which are not described here again.
[0109] The computer readable media of the present embodiments includes permanent and non-permanent, removable and non-removable media can be implemented by any method or technology to store information. The information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information accessible to a computing device.
[0110] Those skilled in the art will understand that the above discussion of any embodiment is merely exemplary and is not intended to be limiting of the scope of the disclosure, including claims, to the examples described above; the above embodiments or technical features between different embodiments can also be combined, the steps can be implemented in any order, and there are many other changes as described above. In order to simplify the description and discussion, and in order not to make the one or more embodiments of the present application difficult to understand, the well-known power / ground connection of integrated circuit (IC) chips and other components can be shown or can not be shown in the provided drawings. In addition, the device can be shown in the form of a block diagram in order to avoid making the one or more embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform to be implemented. The one or more embodiments of the present application. (That is, these details should be fully within the understanding of those skilled in the art.) Where specific details (e.g., circuitry) are set forth in order to describe an exemplary embodiment of the present disclosure, it will be apparent to those skilled in the art that the one or more embodiments of the present application can be practiced without these specific details or with variations on these specific details. Therefore, these descriptions should be considered illustrative rather than limiting.
[0111] In addition, in order to simplify the description and discussion, and in order not to make the one or more embodiments of the present application difficult to understand, the well-known power / ground connection of integrated circuit (IC) chips and other components can be shown or can not be shown in the provided drawings. In addition, the device can be shown in the form of a block diagram in order to avoid making the one or more embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform to be implemented. The one or more embodiments of the present application. (That is, these details should be fully within the understanding of those skilled in the art.) Where specific details (e.g., circuitry) are set forth in order to describe an exemplary embodiment of the present disclosure, it will be apparent to those skilled in the art that the one or more embodiments of the present application can be practiced without these specific details or with variations on these specific details. Therefore, these descriptions should be considered illustrative rather than limiting.
[0112] Although the present disclosure has been described in conjunction with specific embodiments thereof, many alternatives, modifications and variations will be apparent to those skilled in the art in light of the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) can use the embodiments discussed.
[0113] One or more embodiments of the present application are intended to cover all such alternatives, modifications, and variations as come within the scope of the appended claims. Accordingly, any one or more of the omitted, modified, equivalent replacement, improvement, and the like, which come within the spirit and principle of one or more embodiments of the present application, should be included in the protection scope of the present disclosure.
Claims
1. A method of generating text detection, the method comprising: The method comprises: obtaining a text to be detected; obtaining token cohesion of the text to be detected according to the text to be detected, the token cohesion representing semantic closeness between tokens in the text to be detected; obtaining an original prediction value through a basic detection model according to the text to be detected; obtaining a final detection result according to the original prediction value and the token cohesion; The word token cohesion computation model comprises: wherein x represents the text to be detected, represents the copy of the text to be detected, DIFF() represents the semantic difference measure, n represents the number of the copy of the text to be detected; the step of obtaining the final detection result according to the original prediction value and the token cohesion comprises: obtaining a final prediction value according to the original prediction value and the token cohesion through the following formula: w(x) = e u(x) x v(x); wherein u(x) represents the token cohesion of the text to be detected, and v(x) represents the original prediction value of the text to be detected; in response to the final prediction value being greater than a preset threshold, determining that the text to be detected is generated text; in response to the final prediction value being less than or equal to the preset threshold, determining that the text to be detected is not generated text.
2. The method of claim 1, wherein, The step of obtaining the token cohesion of the text to be detected according to the text to be detected comprises: creating a plurality of text to be detected copies according to the text to be detected, the text to be detected copies comprising partial content of the text to be detected; obtaining the token cohesion of the text to be detected through a token cohesion calculation model according to the text to be detected and the text to be detected copies.
3. The method of claim 1, wherein, The basic detection model is trained based on a zero-shot detector.
4. The method of claim 2, wherein, The step of obtaining the token cohesion of the text to be detected through the token cohesion calculation model comprises: invoking the token cohesion calculation model by performing a preset operation, so that the token cohesion calculation model provides a calculation service in a preset manner.
5. A text generation device, characterized by, The method comprises: an obtaining module configured to obtain a text to be detected; a first calculation module configured to obtain token cohesion of the text to be detected according to the text to be detected, the token cohesion representing semantic closeness between tokens in the text to be detected; a second calculation module configured to obtain an original prediction value through a basic detection model according to the text to be detected; a third calculation module configured to obtain a final detection result according to the original prediction value and the token cohesion; The word token cohesion computation model comprises: wherein x represents the text to be detected, represents the copy of the text to be detected, DIFF() represents the semantic difference measure, n represents the number of the copy of the text to be detected; the third calculation module is specifically configured to: the step of obtaining the final detection result according to the original prediction value and the token cohesion comprises: obtaining a final prediction value according to the original prediction value and the token cohesion through the following formula: w(x) = e u(x) x v(x); wherein u(x) represents the token cohesion of the text to be detected, and v(x) represents the original prediction value of the text to be detected; in response to the final prediction value being greater than a preset threshold, determining that the text to be detected is generated text; in response to the final prediction value being less than or equal to the preset threshold, determining that the text to be detected is not generated text.
6. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the method of any one of claims 1 to 4 when executing the program.
7. A non-transitory computer-readable storage medium, comprising: The non-transitory computer-readable storage medium stores computer instructions for causing the computer to execute the method of any one of claims 1 to 4.
Citation Information
Patent Citations
GPT text detection model establishment method and system, computer equipment and storage medium
CN118228737A