Text detection method and system based on information entropy gain and training method thereof
The construction of feature vectors through information entropy gain mapping tables and classification neural networks solves the problem of difficult to quickly and accurately distinguish humans from large models to generate text in the existing technology, and realizes efficient and widely applicable text detection methods, which improves the accuracy and robustness of the detection.
Patent Information
- Application Number
- CN202510528171.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-25
- Publication Date
- 2025-08-08
AI Technical Summary
Existing text detection methods rely on internal parameters or text markers of language models, making it difficult to quickly and accurately distinguish text written by humans and generated by large-scale language models. The scope of application is limited and inefficient.
The information entropy gain mapping table is used to convert text into feature vectors, and binary classification is performed through classification neural networks. The information entropy gain is used to measure the contribution of vocabulary to the text source, construct feature vectors and classify text.
It improves the accuracy and robustness of distinguishing artificial and large-scale text generated, is highly adaptable, does not rely on specific models, and can be widely used in text generated by multiple LLMs, providing a new understanding of text generation technology.
Smart Images

Figure CN120448539A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field related to natural language text source classification, and more specifically, relates to a text detection method, system and training method based on information entropy gain. Background Art
[0002] With the development of large-scale language models (LLMs), these models are capable of generating text that appears to be human-written. For example, these models can generate news articles, social media posts, comments, and academic materials. These generated texts can be used maliciously to spread false information, misleading claims, or manipulate public opinion. This can have serious consequences in politics, business, and social issues, affecting people's judgment and behavior. For example, LLMs can be used to generate papers, assignments, or other academic materials, threatening academic integrity. Generative text technology can also be used to mass-produce spam, phishing emails, or online scams. These messages can leverage the natural language processing capabilities of generative models to mimic the communication styles of real users or businesses, thereby misleading recipients. When ordinary users find it difficult to distinguish between human-generated and machine-generated content, they may doubt the accuracy and reliability of the generated content, leading to a decrease in trust in the source of the information. Therefore, it is necessary to establish effective text detection mechanisms to help users identify machine-generated text, thereby enhancing content transparency and enabling them to take appropriate countermeasures in appropriate scenarios.
[0003] Current text detection methods include those based on the internal mechanisms of language models, statistical feature analysis, and watermarking. Methods based on the model's internal mechanisms detect text using the model's weights and intermediate layer outputs, but their reliance on the model's internal information limits their applicability. Statistical feature analysis analyzes text based on vocabulary and syntactic structure, but is slow and its effectiveness diminishes with large models. Watermarking techniques embed markers in generated text for detection, but are only applicable to text that has been watermarked during generation.
[0004] Therefore, how to quickly and accurately detect text types without relying on the internal parameters of the language model and text tags is a technical problem that needs to be solved urgently. Summary of the Invention
[0005] In response to the above-mentioned defects or improvement needs of the prior art, the present invention provides a text detection method, system and training method based on information entropy gain, the purpose of which is to quickly and accurately detect text types without relying on internal parameters of the language model and text tags.
[0006] To achieve the above object, according to a first aspect of the present invention, a text detection method based on information entropy gain is provided, which comprises
[0007] S1. Converting a text into a feature vector based on an information entropy gain mapping table, wherein the information entropy gain mapping table records information entropy gains corresponding to different words, and the feature vector is composed of information entropy gains of different words in the text;
[0008] S2. Pass the feature vector through a classification neural network and output a binary classification result of whether it is AI text.
[0009] Optionally, in S1, if the text to be detected contains a word that is not recorded in the information entropy gain mapping table, the information entropy gain of the word is directly set to 0.
[0010] According to a second aspect of the present invention, a text detection system based on information entropy gain is provided, comprising:
[0011] A conversion module, configured to convert a text into a feature vector based on an information entropy gain mapping table, wherein the information entropy gain mapping table stores information entropy gains corresponding to different words, and the feature vector is composed of information entropy gains of different words in the text;
[0012] The recognition module is used to pass the feature vector through a classification neural network and output a binary classification result of whether it is AI text.
[0013] According to a third aspect of the present invention, a training method for a text detection system based on information entropy gain is provided, which trains the text detection system based on information entropy gain of the second aspect;
[0014] The training method comprises:
[0015] S100, constructing an information entropy gain mapping table;
[0016] S200. Input the text in the training set into the conversion module to convert the input text into a feature vector based on the information entropy gain mapping table; train a classification neural network with the feature vector as input and the binary classification result of whether it is AI text as output.
[0017] Optionally, constructing the information entropy gain mapping table includes:
[0018] Constructing a text dataset, wherein the text dataset includes artificial humanities and AI text;
[0019] Segmenting each text in the text dataset, and counting the words in the text dataset and their frequencies of occurrence;
[0020] A preset number of words with the highest frequency of occurrence are selected as high-frequency words, the information entropy gain of each high-frequency word is calculated, the high-frequency words and their information entropy gains are recorded, and an information entropy gain mapping table is obtained.
[0021] Optionally, the process of acquiring the AI text includes:
[0022] Extract the prompt words {c1,c2,…,c n}, c i is the i-th prompt word extracted, and the target dataset consists of artificial text;
[0023] Each prompt word c i Input different large-scale language models to generate corresponding AI text;
[0024] All AI texts generated by all prompt words are obtained to obtain the AI texts in the text dataset.
[0025] Optionally, the classification neural network includes a hidden layer and a classification layer. When the classification neural network is trained, the parameters of the hidden layer are frozen, and only the parameters of the classification layer are trained and updated.
[0026] According to a fourth aspect of the present invention, there is provided an electronic device comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any of the above methods when executing the computer program.
[0027] According to a fifth aspect of the present invention, there is provided a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps of any of the above methods when executed by a processor.
[0028] According to a sixth aspect of the present invention, there is provided a computer program product comprising a computer program or instructions, which, when executed by a processor, implement the steps of any of the methods described above.
[0029] In general, compared with the prior art, the above technical solutions conceived by the present invention mainly have the following beneficial effects.
[0030] 1. In the present invention, a classification neural network is used for text classification and a feature vector of the input classification neural network is constructed based on information entropy gain. Among them, constructing a feature vector based on information entropy gain is the core of the present invention. The information entropy gain can be used to measure the contribution of vocabulary to the text source classification. The higher the entropy gain of a vocabulary, the greater its contribution to the text source classification, and the more the classification neural network tends to learn and predict based on this feature. Therefore, the present invention uses a classification neural network for text classification and constructs a feature vector of the input classification neural network based on information entropy gain, which can effectively improve the accuracy, robustness and overall performance of distinguishing between artificial and large model generated texts.
[0031] 2. This invention introduces entropy gain to preprocess text and feed it into a classification neural network to detect its source. Unlike traditional methods that rely on internal model information (such as weights and layer outputs) or watermarks, this invention leverages the inherent properties of text—human-written text generally has higher entropy—to detect text. This method, however, does not require access to the model's internals or the use of watermarks.
[0032] 3. This method is not dependent on a specific large language model, making it highly adaptable and usable on text generated by a variety of LLMs. This feature enables the method to be widely applied in different scenarios without the need for retraining or optimization for each model.
[0033] 4. This paper provides a new understanding of text generation technology by conducting an in-depth analysis of the differences in information entropy between human text and generated text, emphasizes the essential difference between human creative expression and model-generated text, and provides a theoretical basis for subsequent research.
[0034] 5. Furthermore, when constructing the information entropy gain mapping table, since the existing AI text data set is relatively limited, in some embodiments, prompt words are first extracted from the actual data set, and then the corresponding text is generated based on multiple large-scale language models. Each prompt word will generate multiple AI text samples through different models, thereby ensuring the diversity and representativeness of the generated data set.
[0035] 6. Furthermore, when constructing the information entropy gain mapping table, the frequency of occurrence of words is counted and the words with the highest frequency are selected to construct the information entropy gain mapping table, thereby improving the computational efficiency and saving storage space. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 is a flowchart of the steps of a text detection method based on information entropy gain in one embodiment of the present invention;
[0037] Figure 2 is a specific schematic diagram of a text detection method based on information entropy gain in one embodiment of the present invention;
[0038] Figure 3 Schematic diagram of a process for constructing a feature vector based on an information entropy gain mapping table in one embodiment of the present invention;
[0039] Figure 4 is a structural diagram of a text detection system based on information entropy gain in one embodiment of the present invention;
[0040] Figure 5 This is a flowchart of a training method for a text detection system based on information entropy gain in one embodiment of the present invention. DETAILED DESCRIPTION
[0041] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely for the purpose of explaining the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
[0042] Example 1
[0043] The present invention provides a text detection method based on information entropy gain, such as Figure 1 FIG. 1 is a flowchart of a text detection method based on information entropy gain in an embodiment of the present invention. Figure 2 FIG. 1 is a specific schematic diagram of a text detection method based on information entropy gain in one embodiment of the present invention.
[0044] The text detection method based on information entropy gain includes the following steps:
[0045] S1. Convert the text into a feature vector based on an information entropy gain mapping table. The information entropy gain mapping table records the information entropy gains corresponding to different words. The feature vector is composed of the information entropy gains of different words in the text.
[0046] S2. Pass the feature vector through the classification neural network and output a binary classification result of whether it is AI text.
[0047] In the present invention, an information entropy gain mapping table is introduced when performing text classification, and the information entropy gain mapping table records the information entropy gains corresponding to different words.
[0048] Specifically, the information entropy gain mapping table can be constructed through the following operations.
[0049] S01. Build a text dataset, which includes artificial humanities and AI text.
[0050] In one embodiment, since the existing AI texts are relatively limited, in order to obtain more AI texts, a series of AI texts can be generated through multiple large-scale language models to form an AI data set, thereby ensuring that the number of texts in the data set is sufficient and includes AI texts generated by different large-scale language models, ensuring the diversity of data set samples and making the solution more generalizable.
[0051] The process of building an AI dataset through a large-scale language model includes:
[0052] Extract the prompt words {c1,c2,…,c n}, c iFor the i-th cue word extracted, the target dataset consists of artificial text;
[0053] Each prompt word c i Input different large-scale language models to generate corresponding AI text;
[0054] Get all AI texts generated by all prompt words and obtain the AI dataset.
[0055] In the above examples, through the steps of prompt word sampling and text generation, a diverse and large-scale AI dataset was successfully constructed. Prompt word sampling extracts content that effectively guides generation, while text generation transforms these prompts into actual text through LLMs. The resulting dataset provides the necessary foundation for subsequent detection methods.
[0056] Specifically, the target dataset may be an existing dataset, such as X-sum, RoFT, etc.
[0057] Specifically, a large-scale language model can be used to generate prompt words. That is, the artificial text selected from the target dataset is input into the large-scale language model, and the large-scale language model is used to output prompt words. For example, the large-scale language model can be instructed to generate prompt words based on the input content to facilitate subsequent content generation.
[0058] Specifically, we can directly select artificial text from the target dataset to form an artificial dataset, and then combine the artificial dataset with the AI dataset to form a total text dataset. During the specific operation, we try to keep the number of artificial text and AI text equal to avoid any bias that may lead to biased results.
[0059] For example, select a set (or one) of large language models S = {S1, S2, ..., S p}, where S j represents the jth large language model, and p is the total number of models used. For each prompt word c in the prompt word set C i , using each LLMS in the model set S j (j from 1 to p) to generate text. We will use the model S for the kth time j Based on the prompt word c i The generated text sample is represented as x i,j,k .
[0060] x i, j , k =S j (c i );
[0061] All generated text samples x i,j,kCollect them and build the final set T containing all AI texts L This set T L This is our target large-scale generated text dataset. If each prompt word-model combination generates m samples, then the final dataset T L There will be n×p×m text samples in it.
[0062] T L ={x i,j,k |1≤i≤n,1≤j≤p,1≤k≤m;
[0063] T H Represents the set of original, human-written datasets used to sample prompt words, such as X-sum, the original content of the RoFT dataset. Set T = T L ∪T H This creates a large-scale generated text dataset, providing a rich sample base for subsequent mapping table construction and entropy gain calculation. Through the steps of prompt word sampling and text generation, the present invention successfully constructs a diverse and large-scale generated text dataset. Prompt word sampling extracts content that can effectively guide generation, while text generation converts these prompts into actual text through LLMs. The resulting dataset provides the necessary foundation for subsequent detection methods.
[0064] S02. Segment each text in the text dataset, and count the words in the text dataset and their frequencies of occurrence.
[0065] Specifically, the 1-gram vocabulary frequency statistics are performed on the texts in the text dataset T. All the texts in the text dataset T are decomposed into a 1-gram vocabulary set G = {g1, g2, ..., g w}, each word in the text is considered as an independent 1-gram unit. Calculate each word g i The number of occurrences in the data set r(g i ,T), and calculate the frequency q(g i ,T):
[0066]
[0067] Where, q(g i ,T) is the i-th word g in the text dataset T i The frequency of occurrence.
[0068] S03. Select a preset number of words with the highest frequency of occurrence as high-frequency words, calculate the information entropy gain of each high-frequency word, record the high-frequency words and their information entropy gains, and obtain an information entropy gain mapping table.
[0069] In this embodiment, high-frequency words are screened for subsequent processing to reduce computational and storage overhead. After screening out the high-frequency words, the information entropy gain of each word needs to be calculated. After calculating the entropy gain of each high-frequency word, the entropy gain value of each word is stored in a mapping table.
[0070] For example, you can set a ratio of K% to select the K% words with the highest frequency as high-frequency words. The number of high-frequency words is:
[0071]
[0072] Where N topK is the number of high-frequency words filtered out, Represents the floor function.
[0073] Sort the words in the vocabulary set G in descending order according to their frequency q(g,T). Let the sorted sequence be (g (1) ,g (2) ,…,g (|G|) ), so that q(g (1) ,T)≥q(g (2) ,T)≥…≥q(g (|G|) ,T). The final high-frequency vocabulary Φ is obtained by selecting the first N topK Words to build:
[0074]
[0075] The resulting set Φ represents the core high-frequency vocabulary extracted from the generated corpus T, effectively capturing the most salient terms while shrinking the vocabulary space.
[0076] Taking a certain word g as an example, the following introduces the calculation process of the information entropy gain of word g.
[0077] S031. Calculate the information entropy H(T) of the text dataset T. The calculation formula is:
[0078]
[0079] Where, K is the number of categories of text in the text dataset T. In the present invention, the categories of text are divided into artificial text and A text. Therefore, in the present invention, K=2; p i is the text ratio of category i in this dataset T.
[0080] Information entropy is a measure of the uncertainty or complexity of a text set. In the context of this invention, higher information entropy indicates greater text diversity and unpredictability. Conversely, lower information entropy indicates less text diversity and unpredictability, and is more likely to be AI text output by a large model.
[0081] S032. Calculate the conditional entropy of vocabulary g. The calculation formula is:
[0082]
[0083] Where H(T|g) is the conditional entropy of the word g in the text dataset T, |T| is the number of texts in the text dataset T, and T g is the text subset in which the word g appears in the text dataset T, |T g | is the text subset T g The number of texts; T g is the text subset in which the word g does not appear in the text dataset T, For text subset The number of texts, H(T g ) is the text subset T g The information entropy of For text subset Information entropy.
[0084] Conditional entropy is used to measure the uncertainty of a data set given a specific vocabulary g. In the scenario of the present invention, the smaller the conditional entropy, the more likely it is the text output by the large model.
[0085] S033. Calculate the entropy gain ΔH(T,g) of vocabulary g. The calculation formula is:
[0086] ΔH(T,g)=H(T)-H(T|g).
[0087] Information entropy gain is used to measure the information increment obtained after dividing the data set by a certain feature. In the scenario of the present invention, information entropy gain is used to measure the contribution of vocabulary to text source classification (distinguishing between manual writing and large language model generation). The higher the entropy gain of the vocabulary, the greater its contribution to text source classification, and the more the classification neural network tends to learn and predict based on this feature. Therefore, the present invention uses a classification neural network for text classification and constructs a feature vector for input into the classification neural network based on information entropy gain, which can effectively improve the accuracy, robustness and overall performance of distinguishing between manual and large model generated texts.
[0088] Based on the above steps, an information entropy gain mapping table can be constructed, which can be used during system training and actual testing using the system.
[0089] Based on the information entropy gain mapping table, step S1 can be performed, that is, converting the text into a feature vector.
[0090] like Figure 3The figure shows a process diagram of constructing a feature vector based on an information entropy gain mapping table in one embodiment of the present invention. In the mapping table, each high-frequency word g i With the corresponding entropy gain value ΔH(T,g i ), match each word in the text to be tested with the mapping table and find the corresponding entropy gain value. If a word is not in the mapping table, a default value can be assigned, such as 0. Next, construct a feature vector and arrange the entropy gain values of each word in the text into a feature vector e, which represents the entropy gain feature of the text, where n is the number of words in the text.
[0091] e=[ΔH(T,g1),ΔH(T,g2),…,ΔH(T,g n )].
[0092] Then, S2 is executed, that is, the feature vector is passed through the classification neural network to output a binary classification result of whether it is AI text.
[0093] Specifically, a classification neural network generally includes an input layer, a hidden layer, and a classification layer connected in sequence, and the hidden layer belongs to the backbone network of the classification neural network.
[0094] The input layer receives the feature vector e and inputs it into the hidden layer. After the hidden layer performs feature mapping, the hidden layer feature representation z is obtained. The mapping process can be expressed as follows:
[0095] z=f b (e,θ b );
[0096] Where, f b is the mapping function of the hidden layer, θ b It is the parameter of the hidden layer. After the hidden layer, a nonlinear activation function is usually used to introduce nonlinearity so that the network can capture more complex feature relationships.
[0097] The classification layer is responsible for the final text classification based on the hidden layer features and outputs the prediction results. The hidden layer output is passed to the classification layer to obtain the final prediction label
[0098]
[0099] Where, f h is the classification function, θ h are the parameters of the classification layer.
[0100] It is understandable that the parameters in the classification neural network are trainable parameters. In practical applications, the classification neural network is a trained model. The specific training process can be referred to the introduction of Example 3.
[0101] It is understandable that the text used to construct the information entropy gain mapping table and the text detected using the text detection method should belong to the same field, for example, the field of education, medical field, or news field.
[0102] Example 2
[0103] The present invention also provides a text detection system based on information entropy gain, such as Figure 4 FIG2 is a schematic diagram of the structure of a text detection system based on information entropy gain in one embodiment of the present invention, which includes a conversion module and a recognition module;
[0104] The conversion module is used to convert the text into a feature vector based on the information entropy gain mapping table. The information entropy gain mapping table stores the information entropy gains corresponding to different words. The feature vector is composed of the information entropy gains of different words in the text.
[0105] The recognition module is used to pass the feature vector through the classification neural network and output a binary classification result of whether it is AI text.
[0106] The process of obtaining the information entropy gain mapping table and the process of converting the text into a feature vector are described in the first embodiment and will not be repeated here.
[0107] Among them, the classification neural network includes an input layer, a hidden layer and a classification layer connected in sequence. The hidden layer belongs to the backbone network of the classification neural network. The mapping process of each layer to the features refers to the introduction of Example 1 and will not be repeated here.
[0108] The text detection system first converts the text to be detected into a vector consisting of information entropy gain values. Specifically, by looking up the entropy gain value for each word in a mapping table, each word in the text is mapped to an entropy gain value, forming a feature vector. This feature vector is input into the backbone network of the neural network for feature extraction, outputting a hidden layer feature vector. This feature vector is then passed to the classification layer for final classification. The output of the classification network is a predicted label indicating whether the text was written by a human or generated by LLMs.
[0109] The above text detection system can accurately identify the source of text generation by first performing effective feature vectorization and then using a classification neural network for prediction. The design of this text detection system ensures its high efficiency and accuracy in detecting generated text, providing a solid foundation for subsequent research.
[0110] Example 3
[0111] The present invention also provides a training method for a text detection system based on information entropy gain, such as Figure 5FIG2 is a flowchart of a training method for a text detection system based on information entropy gain in one embodiment of the present invention.
[0112] Training methods include:
[0113] S100, constructing an information entropy gain mapping table;
[0114] S200. Input the text in the training set into the conversion module to convert the input text into a feature vector based on the information entropy gain mapping table; train the classification neural network with the feature vector as input and the binary classification result of whether it is AI text as output.
[0115] Specifically, the process of establishing the information entropy gain mapping table and converting the text into a feature vector in step S100 is described in the introduction of embodiment 1 and will not be repeated here.
[0116] Among them, in step S200, the classification neural network includes an input layer, a hidden layer and a classification layer connected in sequence. The hidden layer belongs to the backbone network of the classification neural network. The mapping process of each layer to the features refers to the introduction of Example 1 and will not be repeated here.
[0117] In one embodiment, the training loss function may use cross entropy, that is, using cross entropy as an example to measure the gap between the model's prediction result and the true label:
[0118]
[0119] Where y is the true label, It is the prediction value of the model, which can be 0 or 1, indicating whether the text is human text or AI text respectively.
[0120] During the training process, the model optimizes parameters through the following steps, using the back propagation algorithm to calculate the loss function with respect to the classification layer parameters θ h The gradient of , η is the learning rate, and the parameters are updated according to the calculated gradient:
[0121]
[0122] In one embodiment, in order to improve training efficiency and reduce the risk of overfitting, a strategy of freezing the backbone network is adopted. During the training process, the parameters θ of the backbone network are kept constant. b Unchanged, only the parameters θ of the classification layer are optimized h This approach reduces computational complexity, shortens training time, and avoids overfitting of the model to the training data.
[0123] Example 3
[0124] In order to evaluate and compare the performance of the information entropy gain-based generated text detection scheme (IEGD) proposed in the present invention in detecting text generated by a large language model (LLM), specifically to verify whether the scheme can accurately identify whether a given text is generated by a large model (such as GPT-2, LLAMA, GPT-4, etc.) or written manually. This embodiment uses two standard datasets, X-sum and SQuAD. The experiment covers a variety of different large language models, including GPT-2, OPT-2.7B, Neo-2.7B, LLAMA-7B, LLAMA-13B, GPT-NeoX, GPT-3.5-turbo, GPT-4, and Qwen-2. This experiment uses these models to generate text samples for testing the performance of the detection system. Log-Rank, GLTR, Detect-GPT, LLMDet, SeqXGPT, GECScore, COCO, these are the baseline methods used for comparison, each of which uses different technologies (such as perplexity, statistical features, model probability curvature, grammatical error correction models, etc.) to detect large model generated text.
[0125] Table 1 below shows a comparison of text recognition using different methods. By comparing the values of IEGD with those of other baseline methods, it can be clearly seen that in the vast majority of cases, the IEGD scores of the present invention are significantly higher than all other baseline methods. IEGD achieved the highest accuracy on almost all tested models and datasets. This experimental data strongly demonstrates that the IEGD method significantly outperforms many current mainstream baseline detection methods in distinguishing text generated by large models from text written by humans. It demonstrates high-precision and robust detection capabilities for text generated by large models of various sources and styles, and consistently high-performance detection capabilities for text generated by large language models of various architectures and sizes (from GPT-2 to LLAMA-13B, GPT-4, Qwen-2, etc.). This shows that the method is not limited to a specific type of model and has good generalization capabilities.
[0126] Table 1
[0127]
[0128] Example 4
[0129] The present invention also relates to an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0130] The electronic device may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The processor may be a central processing unit (CPU), or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The memory may be used to store computer programs and / or modules, and the processor may perform various functions of the electronic device by running or executing the computer programs and / or modules stored in the memory, and calling the data stored in the memory.
[0131] Example 5
[0132] The present invention also relates to a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above method when the computer program is executed by a processor.
[0133] Specifically, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0134] Example 6
[0135] An embodiment of the present invention provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the steps of the method of the above embodiment of the present invention.
[0136] The technical features of the above embodiments can be combined in any manner. To simplify the description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification. It should be noted that the phrases "in one embodiment", "for example", "and another example", etc. of the present invention are intended to illustrate the present invention and are not intended to limit the present invention.
[0137] The above embodiments merely illustrate several implementations of the present invention, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the patent application. It should be noted that a person skilled in the art would be able to make numerous variations and improvements without departing from the spirit of the present invention, and all such variations and improvements fall within the scope of protection of the present invention.
Claims
1. A text detection method based on information entropy gain, characterized in that: include S1. Converting a text into a feature vector based on an information entropy gain mapping table, wherein the information entropy gain mapping table records information entropy gains corresponding to different words, and the feature vector is composed of information entropy gains of different words in the text; S2. Pass the feature vector through a classification neural network and output a binary classification result of whether it is AI text.
2. The text detection method according to claim 1, wherein: In S1, if the text to be detected contains a word that is not recorded in the information entropy gain mapping table, the information entropy gain of the word is directly set to 0.
3. A text detection system based on information entropy gain, characterized in that: include: A conversion module, configured to convert a text into a feature vector based on an information entropy gain mapping table, wherein the information entropy gain mapping table stores information entropy gains corresponding to different words, and the feature vector is composed of information entropy gains of different words in the text; The recognition module is used to pass the feature vector through a classification neural network and output a binary classification result of whether it is AI text.
4. A training method for a text detection system based on information entropy gain, characterized in that: Training the text detection system based on information entropy gain as claimed in claim 3; The training method comprises: S100, constructing an information entropy gain mapping table; S200. Input the text in the training set into the conversion module to convert the input text into a feature vector based on the information entropy gain mapping table; train a classification neural network with the feature vector as input and the binary classification result of whether it is AI text as output.
5. The training method according to claim 4, wherein: The constructing of the information entropy gain mapping table includes: Constructing a text dataset, wherein the text dataset includes artificial humanities and AI text; Segmenting each text in the text dataset, and counting the words in the text dataset and their frequencies of occurrence; A preset number of words with the highest occurrence frequency are selected as high-frequency words, the information entropy gain of each high-frequency word is calculated, the high-frequency words and their information entropy gains are recorded, and the information entropy gain mapping table is obtained.
6. The training method according to claim 5, wherein: The process of obtaining the AI text includes: Extract the prompt words {c1,c2,…,c n }, c i is the i-th prompt word extracted, and the target dataset consists of artificial text; Each prompt word c i Input different large-scale language models to generate corresponding AI text; All AI texts generated by all prompt words are obtained to obtain the AI texts in the text dataset.
7. The training method according to claim 4, wherein: The classification neural network includes a hidden layer and a classification layer. When the classification neural network is trained, the parameters of the hidden layer are frozen, and only the parameters of the classification layer are trained and updated.
8. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 or 2 or 4 to 7 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 or 2 or 4 to 7 are implemented.
10. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 or 2 or 4 to 7 are implemented.