Construction method and device of AI text detection model, equipment and storage medium

By constructing the training data set of the AI ​​text detection model and adding a linear layer classifier to the BERT model, the problems of low data utilization and insufficient stability of the AI ​​text detection model are solved, and higher detection accuracy and generalization are achieved abilities have promoted the development of natural language processing technology.

CN118964615APending Publication Date: 2024-11-15PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202411101748.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-12
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

When building and training AI text detection models based on BERT models, the prior art has problems such as low data utilization, insufficient stability and generalization capabilities, and it is difficult to efficiently distinguish AI-generated text from artificially created text.

Method used

By constructing a training data set including AI-generated text and artificially created text, using pre-trained BERT model to add a linear layer classifier, and using cross entropy loss function and optimizer to train the initial classifier, obtain an AI text detection model and improve model detection Accuracy and user confidence.

Benefits of technology

Achieve faster convergence speed and better generalization capabilities, improve detection accuracy, provide an effective and reliable solution, avoid the dissemination of misleading information, promote the development of natural language processing technology and application.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118964615A_ABST
    Figure CN118964615A_ABST
Patent Text Reader

Abstract

The invention relates to a construction method of an AI text detection model, and the method comprises the steps: determining a pre-training BERT model through constructing a training data set comprising a text generated by AI and a text created artificially; and coding the training data in the training data set to obtain corresponding mark data. And adding a linear layer classifier on the pre-trained BERT model to obtain an initial classifier, and training the initial classifier by using the cross entropy loss function, the optimizer and the marked data to obtain an AI text detection model. According to the method, the common sense of the pre-trained BERT model is utilized, the higher convergence speed and better generalization ability can be obtained, the detection accuracy and the user confidence are improved, the spreading of misleading information is avoided, an effective and reliable solution is provided for detecting the AI to generate the Chinese text, and the method is suitable for popularization and application. And development and application of a natural language processing technology are further promoted.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence, and in particular to a method, device, equipment and storage medium for constructing an AI text detection model. Background Art

[0002] With the rapid development of artificial intelligence technology, the ability to generate natural language text has been significantly improved. Modern AI-generated text is almost comparable to human creation in terms of grammar and semantics, and is widely used in news writing, content generation, chatbots and other fields. However, this technological advancement has also brought new challenges, such as how to distinguish AI-generated text from human-created text. Accurately identifying and distinguishing these two types of text is of great significance for protecting copyright, preventing the spread of false information, and maintaining the fairness of content creation.

[0003] Existing text detection technologies mostly rely on statistical features and traditional machine learning methods, such as word frequency statistics and n-gram models, which often perform poorly when processing large-scale, highly complex text. In recent years, text detection methods based on deep learning have gradually emerged, especially pre-trained models (such as BERT), which have performed well in natural language processing tasks. The BERT model can capture the deep semantic information of text by pre-training on a large-scale corpus, providing a new solution for text detection.

[0004] However, how to efficiently build and train an AI text detection model based on the BERT model, as well as how to evaluate its performance, remains a challenging problem. In the existing technology, the optimization and application methods for the BERT model are relatively limited, and the stability and generalization ability of the model need to be further improved. Summary of the invention

[0005] The main purpose of the present invention is to provide a method, device, equipment and storage medium for constructing an AI text detection model, aiming to solve the technical problem of low data utilization in existing knowledge base construction methods.

[0006] To achieve the above object, the present invention provides a method for constructing an AI text detection model, and the method for constructing an AI text detection model comprises the following steps:

[0007] Constructing a training data set, the training data set including text generated by AI and text created by humans, and determining a pre-trained BERT model;

[0008] Encoding the training data in the training data set to obtain corresponding labeled data;

[0009] A linear layer classifier is added to the pre-trained BERT model to obtain an initial classifier, and the initial classifier is trained using a cross entropy loss function and an optimizer and the labeled data to obtain an AI text detection model.

[0010] Optionally, the step of adding a linear layer classifier to the pre-trained BERT model to obtain an initial classifier includes:

[0011] The linear layer classifier is a fully connected layer classifier, and a fully connected layer classifier is added to the pre-trained BERT model to obtain the initial classifier.

[0012] Optionally, the step of using a cross entropy loss function and an optimizer and the labeled data to train the initial classifier to obtain an AI text detection model includes:

[0013] Initializing the parameters of the initial classifier, inputting the labeled data into the initial classifier, and obtaining a prediction result;

[0014] Calculating the gradient information of the parameters of the initial classifier using the cross entropy loss function and the prediction result;

[0015] The optimizer updates the parameters of the initial classifier through the gradient information of the parameters of the initial classifier to obtain the AI ​​text detection model.

[0016] Optionally, the step of encoding the training data in the training data set to obtain corresponding labeled data includes:

[0017] Determine a word segmentation tool, and use the word segmentation tool to segment sentences in the training data to generate a word list;

[0018] Using the vocabulary of the pre-trained BERT model, the words in the word list are converted into corresponding labeled data.

[0019] Optionally, the step of constructing a training data set includes:

[0020] Human-created texts are obtained as positive examples, AI-generated texts are obtained as negative examples, and the same number of positive examples and negative examples are selected to construct the training data set.

[0021] Optionally, after the step of obtaining the AI ​​text detection model, the step further includes:

[0022] The performance of the AI ​​text detection model is evaluated by a cross-validation method, and the performance includes stability and generalization ability.

[0023] Optionally, after the step of obtaining the AI ​​text detection model, the step further includes:

[0024] Obtain the text to be detected, input the text to be detected into the AI ​​text detection model, and determine whether the text to be detected is AI-generated text.

[0025] Furthermore, to achieve the above-mentioned purpose, the present invention also provides a device for constructing an AI text detection model, and the device for constructing an AI text detection model comprises:

[0026] A data acquisition module constructs a training data set, wherein the training data set includes text generated by AI and text created by humans, and determines a pre-trained BERT model;

[0027] A data encoding module encodes the training data in the training data set to obtain corresponding labeled data;

[0028] The model training module adds a linear layer classifier to the pre-trained BERT model to obtain an initial classifier, and trains the initial classifier using a cross entropy loss function and an optimizer and the labeled data to obtain an AI text detection model.

[0029] Furthermore, to achieve the above-mentioned purpose, the present invention also provides a device for constructing an AI text detection model, wherein the device for constructing an AI text detection model comprises a memory, a processor, and a construction program for an AI text detection model stored in the memory and executable on the processor, and when the construction program for the AI ​​text detection model is executed by the processor, the steps of the method for constructing an AI text detection model as described above are implemented.

[0030] Furthermore, to achieve the above-mentioned purpose, the present invention also provides a storage medium, on which a construction program of an AI text detection model is stored, and when the construction program of the AI ​​text detection model is executed by a processor, the steps of the construction method of the AI ​​text detection model as described above are implemented.

[0031] The present invention relates to a method for constructing an AI text detection model, and a pre-trained BERT model is determined by constructing a training data set including AI-generated text and artificially created text. The training data in the training data set is encoded to obtain corresponding labeled data. A linear layer classifier is added to the pre-trained BERT model to obtain an initial classifier, and the initial classifier is trained using a cross entropy loss function, an optimizer and labeled data to obtain an AI text detection model. The present invention utilizes the common sense of the pre-trained BERT model to obtain a faster convergence speed and better generalization ability, improve the accuracy of detection and user confidence, avoid the spread of misleading information, and provide an effective and reliable solution for detecting AI-generated Chinese text, further promoting the development and application of natural language processing technology. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 A schematic diagram of the structure of the device hardware operating environment involved in the embodiment of the device for building the AI ​​text detection model of the present invention;

[0033] Figure 2 This is a flow chart of a first embodiment of a method for constructing an AI text detection model of the present invention;

[0034] Figure 3 This is a schematic diagram of the functional modules of a preferred embodiment of the device for constructing the AI ​​text detection model of the present invention.

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

[0036] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0037] It should be noted that with the rapid development of artificial intelligence technology, the ability to generate natural language text has been significantly improved. Modern AI-generated text is almost comparable to human creation in terms of grammar and semantics, and is widely used in news writing, content generation, chatbots and other fields. However, this technological advancement has also brought new challenges, such as how to distinguish between AI-generated text and human-created text. Accurately identifying and distinguishing these two types of text is of great significance for protecting copyright, preventing the spread of false information, and maintaining the fairness of content creation.

[0038] Existing text detection technologies mostly rely on statistical features and traditional machine learning methods, such as word frequency statistics and n-gram models, which often perform poorly when processing large-scale, highly complex text. In recent years, text detection methods based on deep learning have gradually emerged, especially pre-trained models (such as BERT), which have performed well in natural language processing tasks. The BERT model can capture the deep semantic information of text by pre-training on a large-scale corpus, providing a new solution for text detection.

[0039] However, how to efficiently build and train an AI text detection model based on the BERT model, as well as how to evaluate its performance, remains a challenging problem. In the existing technology, the optimization and application methods for the BERT model are relatively limited, and the stability and generalization ability of the model need to be further improved.

[0040] Based on the above defects, the present invention provides a device for constructing an AI text detection model, referring to Figure 1 , Figure 1 This is a schematic diagram of the structure of the device hardware operating environment involved in the device implementation scheme for building the AI ​​text detection model of the present invention.

[0041] like Figure 1 As shown, the construction device of the AI ​​text detection model may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0042] Those skilled in the art will understand that Figure 1 The hardware structure of the device for building the AI ​​text detection model shown in the figure does not constitute a limitation on the device for building the AI ​​text detection model, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0043] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a program for constructing an AI text detection model. The operating system is a program for managing and controlling the construction equipment and software resources of the AI ​​text detection model, and supports the operation of the network communication module, the user interface module, the program for constructing the AI ​​text detection model, and other programs or software; the network communication module is used to manage and control the network interface 1004; and the user interface module is used to manage and control the user interface 1003.

[0044] exist Figure 1 In the hardware structure of the AI ​​text detection model construction device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client and communicate data with the client; the processor 1001 can call the AI ​​text detection model construction program stored in the memory 1005 and perform the following operations:

[0045] Constructing a training data set, the training data set including text generated by AI and text created by humans, and determining a pre-trained BERT model;

[0046] Encoding the training data in the training data set to obtain corresponding labeled data;

[0047] A linear layer classifier is added to the pre-trained BERT model to obtain an initial classifier, and the initial classifier is trained using a cross entropy loss function and an optimizer and the labeled data to obtain an AI text detection model.

[0048] Furthermore, the step of adding a linear layer classifier to the pre-trained BERT model to obtain an initial classifier includes:

[0049] The linear layer classifier is a fully connected layer classifier, and a fully connected layer classifier is added to the pre-trained BERT model to obtain the initial classifier.

[0050] Furthermore, the step of using the cross entropy loss function and the optimizer and the labeled data to train the initial classifier to obtain the AI ​​text detection model includes:

[0051] Initializing the parameters of the initial classifier, inputting the labeled data into the initial classifier, and obtaining a prediction result;

[0052] Calculating the gradient information of the parameters of the initial classifier using the cross entropy loss function and the prediction result;

[0053] The optimizer updates the parameters of the initial classifier through the gradient information of the parameters of the initial classifier to obtain the AI ​​text detection model.

[0054] Furthermore, the step of encoding the training data in the training data set to obtain corresponding labeled data includes:

[0055] Determine a word segmentation tool, and use the word segmentation tool to segment sentences in the training data to generate a word list;

[0056] Using the vocabulary of the pre-trained BERT model, the words in the word list are converted into corresponding labeled data.

[0057] Furthermore, the step of constructing a training data set includes:

[0058] Human-created texts are obtained as positive examples, AI-generated texts are obtained as negative examples, and the same number of positive examples and negative examples are selected to construct the training data set.

[0059] Furthermore, after the step of obtaining the AI ​​text detection model, the step further includes:

[0060] The performance of the AI ​​text detection model is evaluated by a cross-validation method, and the performance includes stability and generalization ability.

[0061] Furthermore, after the step of obtaining the AI ​​text detection model, the step further includes:

[0062] Obtain the text to be detected, input the text to be detected into the AI ​​text detection model, and determine whether the text to be detected is AI-generated text.

[0063] The specific implementation of the device for constructing the AI ​​text detection model of the present invention is basically the same as the various embodiments of the method for constructing the AI ​​text detection model described below, and will not be repeated here.

[0064] The present invention also provides a method for constructing an AI text detection model based on the above-mentioned AI text detection model construction device.

[0065] Reference Figure 2 , Figure 2 The figure is a flow chart of the first embodiment of the method for constructing an AI text detection model of the present invention.

[0066] An embodiment of the present invention provides an embodiment of a method for constructing an AI text detection model. It should be noted that although the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in an order different from that shown here.

[0067] In various embodiments of the method for constructing an AI text detection model, the execution subject is a device for constructing an AI text detection model.

[0068] The method for constructing the AI ​​text detection model is applied to a device for constructing the AI ​​text detection model, and the method for constructing the AI ​​text detection model includes:

[0069] Step S10, constructing a training data set, wherein the training data set includes text generated by AI and text created by humans, and determining a pre-trained BERT model;

[0070] With the rapid development of artificial intelligence technology, the ability to generate natural language text has been significantly improved. Modern AI-generated text is almost comparable to human creation in terms of grammar and semantics, and is widely used in news writing, content generation, chatbots and other fields. However, this technological advancement has also brought new challenges, such as how to distinguish AI-generated text from human-created text. Accurately identifying and distinguishing these two types of text is of great significance for protecting copyright, preventing the spread of false information, and maintaining the fairness of content creation.

[0071] Existing text detection technologies mostly rely on statistical features and traditional machine learning methods, such as word frequency statistics and n-gram models, which often perform poorly when processing large-scale, highly complex text. In recent years, text detection methods based on deep learning have gradually emerged, especially pre-trained models (such as BERT), which have performed well in natural language processing tasks. The BERT model can capture the deep semantic information of text by pre-training on a large-scale corpus, providing a new solution for text detection.

[0072] However, how to efficiently build and train an AI text detection model based on the BERT model, as well as how to evaluate its performance, remains a challenging problem. In the existing technology, the optimization and application methods for the BERT model are relatively limited, and the stability and generalization ability of the model need to be further improved.

[0073] The method for constructing an AI text detection model in this embodiment is applicable to a device having the function of the method for constructing an AI text detection model.

[0074] In this embodiment, building a high-quality training dataset is one of the key steps to the success of the AI ​​text detection model.

[0075] Collect a large amount of AI-generated text and human-created text to ensure that the data source is legitimate and representative. AI-generated text refers to the use of various AI text generation tools (such as GPT-3, ChatGPT, etc.) to generate a large amount of text data; the generated text should cover a variety of topics and fields, such as news reports, social media posts, technical documents, etc. Human-created text refers to the collection of a large amount of manually written text data from legitimate sources. These texts can come from news websites, blogs, social media, academic papers, etc., to ensure that they cover a variety of topics and fields.

[0076] After receiving the text data, the data can be cleaned, including: deduplication, removing duplicate text data to ensure the uniqueness and diversity of the data; denoising, deleting noise data in the text, such as advertisements, special characters, garbled characters, etc., to ensure the cleanliness of the data; standardization, standardizing the text, including case conversion, punctuation unification, etc.

[0077] Annotate the text data, annotate human-generated text as positive examples (labeled as 1), and annotate AI-generated text as negative examples (labeled as 0). Make sure the number of positive and negative examples is roughly equal to avoid class imbalance during model training.

[0078] In addition, the annotated text data can be further divided into training set, validation set and test set for model training, model validation and model testing respectively. Usually, the training set accounts for 70% of the total data volume, and the validation set and test set each account for 15%. This division method can ensure that the model performs consistently on different data sets.

[0079] Example description:

[0080] Data collection: AI-generated text, using GPT-3 to generate 5,000 news reports covering multiple fields such as politics, economy, technology, and entertainment; human-created text, collecting 5,000 news reports from well-known news websites (such as Xinhuanet and People's Daily Online), ensuring that the sources are legal and the content is rich.

[0081] Data cleaning: remove duplicate news reports; remove advertisements and special characters; standardize punctuation and capitalization.

[0082] Data labeling: Collected news reports are labeled by source: AI-generated text is labeled as 0, and human-created text is labeled as 1.

[0083] Data division: A total of 10,000 news reports are divided into a training set (7,000), a validation set (1,500), and a test set (1,500).

[0084] The training dataset constructed through the above steps can ensure the data quality and diversity of the AI ​​text detection model during the training process, thereby improving the detection accuracy and generalization ability of the model.

[0085] At the same time, determine the pre-trained BERT model and select an appropriate pre-trained model. The model selection can be as follows:

[0086] BERT-Base: Suitable for most text processing tasks, with faster training speed and smaller computing resource requirements. The model contains 12 Transformer layers, 768 hidden units in each layer, and a total parameter count of about 110M.

[0087] BERT-Large: Suitable for complex tasks that require higher accuracy, with larger computing resource requirements and slower training speed. The model contains 24 Transformer layers, 1024 hidden units per layer, and a total parameter count of approximately 340M.

[0088] Other variants: such as RoBERTa, ALBERT, DistilBERT, etc., can be selected according to specific needs. These variants have different performances on different tasks and resource requirements.

[0089] Then, download a pre-trained BERT model from Hugging Face's Transformers library or other trusted sources. Configure the model's hyperparameters, including maximum sequence length, batch size, learning rate, etc. Combine the pre-trained BERT model with a specific task (e.g., text classification, text generation). Add appropriate classifiers or other layers on top of the model to achieve a specific task.

[0090] Example description: Select the BERT-Base model for text classification

[0091] Model type: BERT-Base

[0092] Applicable scenarios: Applicable to most text classification tasks, such as news classification, sentiment analysis, etc.

[0093] Computing resource requirements: Moderate, can be trained on a regular GPU.

[0094] Step S20, encoding the training data in the training data set to obtain corresponding labeled data;

[0095] In this embodiment, this step includes converting the text data into a format that can be processed by the model, that is, converting the text into token data. The specific implementation method can be as follows:

[0096] Select word segmentation tool: Select an appropriate word segmentation tool, such as Jieba word segmenter, THULAC, etc., to segment Chinese text into individual words or sub-word units.

[0097] Text segmentation: Use the word segmentation tool to segment each sentence in the training data and generate a word list. The word segmentation tool converts the text into a series of words that can better reflect the semantic structure of the text.

[0098] Use vocabulary for conversion: Use the vocabulary of the pre-trained BERT model to convert the word list after segmentation into corresponding labeled data (Token ID). Each word in the vocabulary corresponds to a unique index (Token ID), which will be used as the input of the model.

[0099] Add special tags: Add [CLS] tags at the beginning of each sentence to indicate the beginning of the sentence; add [SEP] tags at the end of the sentence to indicate the end of the sentence. These special tags help the model better understand the structure and boundaries of sentences.

[0100] Generate model input format: For each sentence, generate the following input format:

[0101] Input ID sequence: a sequence of token IDs representing each word in a sentence. Attention Mask: used to distinguish filler words from actual words, with actual words being 1 and filler words being 0.

[0102] Token Type IDs: IDs used to distinguish different sentences. For a single sentence input, the segment IDs of all tokens are 0.

[0103] Example: Encoding a news text

[0104] Select word segmentation tool: Select Jieba word segmenter to segment Chinese text.

[0105] Text segmentation: Segment the sentence "I like natural language processing" and get the word list ["I", "like", "natural", "language", "processing"].

[0106] Convert using vocabulary: Use the vocabulary of the pre-trained BERT model to convert the word list into a sequence of TokenIDs. Assume that the indexes in the vocabulary are: ["I"->2769, "like"->1637, "nature"->7476, "language"->6429, "processing"->1351].

[0107] Add special tags: Add [CLS] and [SEP] tags at the beginning and end of the token ID sequence, respectively. Suppose [CLS]->101, [SEP]->102.

[0108] Generate model input format:

[0109] Input ID sequence: [101,2769,1637,7476,6429,1351,102]

[0110] Attention mask: [1,1,1,1,1,1,1]

[0111] Segment ID: [0,0,0,0,0,0,0]

[0112] Step S30, adding a linear layer classifier to the pre-trained BERT model to obtain an initial classifier, training the initial classifier using a cross entropy loss function and an optimizer and the labeled data to obtain an AI text detection model.

[0113] In this embodiment, adding a linear layer classifier to the pre-trained BERT model and training it is a key step in building an AI text detection model. The specific implementation method can be:

[0114] Add a linear layer classifier: Select the pre-trained BERT model and add a linear layer classifier (such as a fully connected layer) on top of it. This classifier is used to map the features output by the BERT model to specific classification labels.

[0115] Define the loss function: You can use the cross-entropy loss function as a loss function to measure the difference between the model's prediction results and the actual labels. The cross-entropy loss function is suitable for classification tasks and can effectively optimize model performance.

[0116] Choose an optimizer: Choose an appropriate optimizer, such as the stochastic gradient descent (SGD) optimizer or the Adam optimizer, to update the model parameters. The choice of optimizer depends on the specific task and computing resources.

[0117] Model training: Initialize model parameters and set training hyperparameters (such as learning rate, batch size, number of training rounds, etc.). Input the encoded training data (labeled data) into the initial classifier and perform forward propagation to calculate the prediction results. Calculate the cross entropy loss between the prediction results and the actual labels, and perform backward propagation to calculate the gradient information. Use the optimizer to update the model parameters according to the gradient information and perform multiple rounds of iterative training until the model converges.

[0118] Example description:

[0119] Add a linear layer classifier: Select the pre-trained BERT-Base model. Add a linear layer classifier on top of the BERT model to map the features output by the BERT model to two classification labels (AI generated and human created).

[0120] Define the loss function: Select the cross-entropy loss function as the loss function for the classification task.

[0121] Select optimizer: Select Adam optimizer and initialize optimizer parameters (such as learning rate).

[0122] Model training: Initialization parameters: Initialize classifier parameters and set training hyperparameters (such as learning rate 0.001, batch size 32, number of training rounds 10). Input the encoded news text into the BERT model to obtain the output features of the BERT model. Use a linear layer classifier to map the BERT output features to the classification labels and calculate the cross entropy loss between the predicted results and the actual labels. Calculate the gradient information of the loss function relative to the classifier parameters. Use the Adam optimizer to update the classifier parameters according to the gradient information and perform multiple rounds of iterative training until the model converges.

[0123] The present invention relates to a method for constructing an AI text detection model, and a pre-trained BERT model is determined by constructing a training data set including AI-generated text and artificially created text. The training data in the training data set is encoded to obtain corresponding labeled data. A linear layer classifier is added to the pre-trained BERT model to obtain an initial classifier, and the initial classifier is trained using a cross entropy loss function, an optimizer and labeled data to obtain an AI text detection model. The present invention utilizes the common sense of the pre-trained BERT model to obtain a faster convergence speed and better generalization ability, improve the accuracy of detection and user confidence, avoid the spread of misleading information, and provide an effective and reliable solution for detecting AI-generated Chinese text, further promoting the development and application of natural language processing technology.

[0124] Furthermore, a second embodiment of the method for constructing an AI text detection model of the present invention is proposed. In the above step S30, the step of adding a linear layer classifier to the pre-trained BERT model to obtain an initial classifier includes:

[0125] Step a1, the linear layer classifier is a fully connected layer classifier, and a fully connected layer classifier is added to the pre-trained BERT model to obtain the initial classifier.

[0126] In this embodiment, a fully connected layer classifier is added to the output layer of the BERT model to map the text features extracted by the BERT model to specific classification labels. The specific steps may include:

[0127] Select the pre-trained BERT model:

[0128] Choose an appropriate pre-trained BERT model (such as BERT-Base or BERT-Large), depending on the complexity and resource requirements of the task.

[0129] Get BERT model output features: Encode the input text data into a Token ID sequence and input it into the pre-trained BERT model. Get the output features of the BERT model, usually using the output of the [CLS] tag to represent the features of the entire sentence.

[0130] Add a fully connected layer classifier: Add a fully connected layer classifier (linear layer) to the output features of the BERT model. This classifier is used to map the output features of BERT to specific classification labels. Get the initial classifier.

[0131] Initialize classifier parameters: Initialize the parameters of the fully connected layer classifier to ensure that the model has a good parameter state at the beginning of training.

[0132] Configure loss function and optimizer: Select Cross-Entropy Loss as the loss function for the classification task. Select a suitable optimizer, such as Stochastic Gradient Descent (SGD) optimizer or Adam optimizer, to update the model parameters.

[0133] Training the initial classifier: Input the encoded training data (labeled data) into the initial classifier and perform forward propagation to calculate the prediction results. Calculate the cross entropy loss between the prediction results and the actual labels, and perform backward propagation to calculate the gradient information. Use the optimizer to update the model parameters according to the gradient information, and perform multiple rounds of iterative training until the model converges.

[0134] Example description:

[0135] Select a pre-trained BERT model: Select the pre-trained BERT-Base model, which is suitable for most Chinese text processing tasks.

[0136] Get the output features of the BERT model: Encode the sentence "I like natural language processing" into a sequence of token IDs and input it into the BERT model. Get the output features of the BERT model and use the output of the [CLS] tag to represent the features of the entire sentence.

[0137] Add a fully connected layer classifier: Add a fully connected layer classifier to the output features of the BERT model, with an output dimension of 2 (corresponding to two types of labels: AI generated and human-created). The structure of the fully connected layer classifier is as follows: the input dimension is the output dimension of the BERT model (such as 768 for BERT-Base), and the output dimension is 2.

[0138] Initialize classifier parameters: Use the Xavier initialization method to initialize the parameters of the fully connected layer classifier to ensure that the parameter distribution is moderate.

[0139] Configure loss function and optimizer: Select Cross-Entropy Loss as the loss function for the classification task. Select Adam optimizer, set the learning rate and other hyperparameters.

[0140] Training the initial classifier: Input the encoded news text data into the initial classifier, perform forward propagation, and obtain the prediction results. Calculate the cross entropy loss between the prediction results and the actual labels. Perform backward propagation to calculate the gradient information and update the model parameters. Perform multiple rounds of iterative training until the model converges to obtain the final AI text detection model.

[0141] This embodiment can significantly improve the performance of the AI ​​text detection model by adding a fully connected layer classifier to the pre-trained BERT model and performing parameter initialization and optimization configuration. The model can accurately distinguish AI-generated text from human-created text in various text detection tasks, and has broad application prospects and good generalization capabilities.

[0142] Furthermore, a third embodiment of the method for constructing an AI text detection model of the present invention is proposed. In the above step S30, the step of using the cross entropy loss function and the optimizer and the labeled data to train the initial classifier to obtain the AI ​​text detection model includes:

[0143] Step b1, initializing the parameters of the initial classifier, inputting the labeled data into the initial classifier, and obtaining a prediction result;

[0144] Step b2, using the cross entropy loss function and the prediction result to calculate the gradient information of the parameters of the initial classifier;

[0145] Step b3, the optimizer updates the parameters of the initial classifier through the gradient information of the parameters of the initial classifier to obtain the AI ​​text detection model.

[0146] In this embodiment, the process of training the initial classifier using the cross entropy loss function, the optimizer and the labeled data to obtain the AI ​​text detection model includes initializing the classifier parameters, performing forward propagation to calculate the prediction results, calculating the loss function and gradient information, and updating the classifier parameters using the optimizer. The following are the detailed implementation steps:

[0147] Initialize classifier parameters: After adding the fully connected layer classifier, use an appropriate method (such as Xavier initialization or He initialization) to initialize the classifier parameters. This helps the model obtain a good parameter state in the early stage of training and promotes model convergence.

[0148] Forward propagation calculation prediction results: Input the labeled data (i.e. the encoded training data) into the initial classifier for forward propagation calculation. The BERT model will generate feature representations of the input text, and then the fully connected layer classifier will map these features to specific classification labels to obtain the prediction results.

[0149] Calculate the cross-entropy loss function: Use the cross-entropy loss function to calculate the loss between the predicted result and the actual label. The cross-entropy loss function is suitable for classification tasks and can effectively optimize model performance.

[0150] Calculate gradient information: Perform back propagation calculations to calculate the gradient information of the cross entropy loss function relative to the initial classifier parameters. This step is used to obtain the direction and magnitude of the model parameters that need to be adjusted.

[0151] Use an optimizer to update classifier parameters: Select a suitable optimizer, such as the stochastic gradient descent (SGD) optimizer or the Adam optimizer. The optimizer uses the calculated gradient information to update the parameters of the initial classifier. Through multiple rounds of iterative training, the model parameters are continuously optimized, and finally an AI text detection model with good performance is obtained.

[0152] Example description:

[0153] Initialize classifier parameters: Add a fully connected layer classifier based on the BERT-Base model, with an input dimension of 768 and an output dimension of 2 (AI generated and human-created). Use the Xavier initialization method to initialize the parameters of the fully connected layer classifier.

[0154] Forward propagation calculates the prediction results: The encoded news text is input into the initial classifier. The BERT model generates a feature representation for each text, using the output of the [CLS] tag to represent the features of the entire sentence. The fully connected layer classifier maps the features to two classification labels to obtain the prediction results.

[0155] Calculate the cross entropy loss function: Use the cross entropy loss function to calculate the loss between the predicted results and the actual labels.

[0156] Calculate gradient information: Perform backpropagation calculation to calculate the gradient information of the cross entropy loss function relative to the classifier parameters.

[0157] Use the optimizer to update the classifier parameters: Select the Adam optimizer and set the learning rate to 0.001. Use the Adam optimizer to update the classifier parameters based on the gradient information and perform multiple rounds of iterative training until the model converges to obtain the final AI text detection model.

[0158] Through the above detailed training process, this embodiment can obtain an AI text detection model with good performance. The model can accurately distinguish AI-generated text from human-created text in various text detection tasks, and has broad application prospects and good generalization ability.

[0159] Furthermore, a fourth embodiment of the method for constructing an AI text detection model of the present invention is proposed, wherein the above step S20 includes:

[0160] Step c1, determining a word segmentation tool, using the word segmentation tool to segment the sentences in the training data, and generating a word list;

[0161] Step c2, using the vocabulary of the pre-trained BERT model, converting the words in the word list into corresponding labeled data.

[0162] In this embodiment, encoding the training data in the training data set is to convert the original text data into a format that can be processed by the model. This process includes selecting a word segmentation tool, segmenting the sentence, and converting the word list into labeled data. The specific implementation method is as follows:

[0163] Determine the word segmentation tool: Choose a word segmentation tool suitable for Chinese text processing, such as Jieba word segmenter, THULAC, etc. These word segmentation tools can split sentences into separate words or sub-word units, which helps the model better understand the semantic structure of the text.

[0164] Text segmentation: Use the selected segmentation tool to segment each sentence in the training dataset and generate a list of words. The segmentation process converts the original sentence into a series of words for subsequent processing.

[0165] Use vocabulary for conversion: Use the vocabulary of the pre-trained BERT model to convert the word list after segmentation into corresponding labeled data (Token ID). Each word has a unique index (Token ID) in the vocabulary, and these indexes will be used as input to the model.

[0166] Add special tags: Add special tags like [CLS] and [SEP] at the beginning and end of each sentence. These tags help the model understand the structure and boundaries of sentences.

[0167] Generate model input format:

[0168] For each sentence, the following input format is generated:

[0169] Input ID sequence: A sequence of token IDs representing each word in the sentence.

[0170] Attention Mask: It is used to distinguish filler words from actual words. The actual words are 1 and the filler words are 0.

[0171] Token Type IDs: IDs used to distinguish different sentences. For a single sentence input, the segment IDs of all tokens are 0.

[0172] Example description:

[0173] Determine the word segmentation tool: Select THULAC word segmenter to segment Chinese text.

[0174] Text segmentation: Segment the sentence "Today's weather is very good, suitable for going out to play" and get the word list ["today", "weather", "very", "good", ","", "suitable", "going out", "playing"].

[0175] Convert using vocabulary: Use the vocabulary of the pre-trained BERT model to convert the word list into a sequence of token IDs. Assume that the indexes in the vocabulary are: ["today"->2000, "weather"->3400, "very"->1500, "good"->1000, ","->120, "suitable"->4500, "go out"->5600, "play"->3000].

[0176] Add special tags: Add [CLS] and [SEP] tags at the beginning and end of the token ID sequence, respectively. Suppose [CLS]->101, [SEP]->102.

[0177] Generate model input format:

[0178] Input ID sequence: [101,2000,3400,1500,1000,120,4500,5600,3000,102]

[0179] Attention mask: [1,1,1,1,1,1,1,1,1,1]

[0180] Segment ID: [0,0,0,0,0,0,0,0,0,0]

[0181] Through the above steps, this embodiment encodes the training data in the training data set to obtain corresponding labeled data. These labeled data will be used as input to the model to ensure that the model can correctly process and understand the text data, which helps to improve the detection accuracy and generalization ability of the model.

[0182] Furthermore, a fifth embodiment of the method for constructing an AI text detection model of the present invention is proposed. In the above step S10, the step of constructing a training data set includes:

[0183] Step d1, obtain human-created text as positive examples, obtain AI-generated text as negative examples, and select the same number of positive examples and negative examples to construct the training data set.

[0184] In this embodiment, it includes obtaining human-generated text as positive examples, obtaining AI-generated text as negative examples, and ensuring that the number of positive examples and negative examples is equal to build a balanced training data set. The specific steps may include:

[0185] Obtain human-generated text: Collect a large amount of human-generated text from legitimate sources. This text can include news articles, blog posts, social media posts, academic papers, etc. Make sure the collected text covers a variety of topics and fields to increase the diversity and representativeness of the data.

[0186] Obtain AI-generated text: Generate a large amount of text data using various AI text generation tools (such as GPT-3, ChatGPT, etc.). These texts should cover the same or similar topics and fields as human-generated texts. Ensure that the generated texts have a certain quality and authenticity to better train the model.

[0187] Data cleaning and preprocessing: Remove duplicate text data to ensure data uniqueness and diversity. Delete noise data, such as advertisements, special characters, garbled characters, etc., to ensure data cleanliness. Standardize text, including case conversion, punctuation unification, etc.

[0188] Data labeling: Label human-generated text as positive examples (labeled as 1) and AI-generated text as negative examples (labeled as 0). Make sure the number of positive and negative examples is roughly equal to avoid the impact of class imbalance on model training.

[0189] Data division: divide the labeled data into training set, validation set and test set. Usually, the training set accounts for 70% of the total data volume, and the validation set and test set account for 15% each. Ensure that the ratio of positive and negative examples in each data set is consistent to maintain the consistency of the data set.

[0190] Example description:

[0191] Obtaining human-created texts: Collect 5,000 news articles from well-known news websites (such as Xinhuanet and People's Daily Online). These articles cover politics, economy, technology, entertainment and other fields, ensuring that the sources are legitimate and the content is rich.

[0192] Get AI-generated text: Use GPT-3 to generate 5,000 news articles covering the same topics and fields as human-generated news. Ensure that the generated text is of high quality and authenticity.

[0193] Data cleaning and preprocessing: Remove duplicate news articles. Remove advertisements and special characters. Standardize punctuation and capitalization.

[0194] Data labeling: The collected news articles are labeled according to their source: human-generated news articles are labeled as positive examples (1), and AI-generated news articles are labeled as negative examples (0).

[0195] Data partitioning: A total of 10,000 news articles were divided into a training set (7,000 articles), a validation set (1,500 articles), and a test set (1,500 articles). Ensure that the ratio of positive and negative examples in each dataset is consistent.

[0196] The high-quality training data set constructed by the above steps in this embodiment can significantly improve the training effect of the AI ​​text detection model, enabling the model to accurately distinguish AI-generated text from human-created text. At the same time, the model has good generalization ability and is suitable for a variety of practical application scenarios.

[0197] Furthermore, a sixth embodiment of the method for constructing an AI text detection model of the present invention is proposed, and after the above step S30, it also includes:

[0198] Step e1, evaluating the performance of the AI ​​text detection model by a cross-validation method, wherein the performance includes stability and generalization ability.

[0199] In this embodiment, after the AI ​​text detection model is trained, the performance of the model needs to be evaluated to ensure its stability and generalization ability. Cross-validation is a commonly used model evaluation method, which divides the data set into multiple subsets, repeatedly trains and verifies the model, and thus obtains a more stable and reliable performance evaluation. The specific implementation is as follows:

[0200] Dataset partitioning: Divide the entire dataset into K non-overlapping subsets (folds), usually K = 5 or K = 10. Ensure that the ratio of positive and negative examples in each subset is consistent.

[0201] Cross-validation process: Perform K cycles, each time selecting a different subset as the validation set, and the remaining K-1 subsets as the training set. Train the AI ​​text detection model on the current training set, and evaluate it on the current validation set, recording the evaluation indicators (such as accuracy, precision, recall, F1 score, etc.).

[0202] Calculate the average performance index: Calculate the average of all evaluation indicators as the final performance indicator of the model. The average performance indicator can provide a more comprehensive and stable model evaluation result.

[0203] Evaluate the stability and generalization ability of the model: Evaluate the stability and generalization ability of the model through the average performance index obtained by cross-validation. Analyze the differences in each evaluation index. If the difference between each evaluation index is small, it means that the model has good stability; if the average evaluation index is high, it means that the model has good generalization ability.

[0204] Example description:

[0205] Dataset division: The news text dataset is divided into 5 non-overlapping subsets (K=5), ensuring that the ratio of positive examples (human-generated news) to negative examples (AI-generated news) in each subset is consistent.

[0206] Cross-validation process: Cycle 1: Use subset 1 as the validation set and subsets 2-5 as the training set. Train the AI ​​text detection model on the training set and evaluate the model performance on the validation set, recording the accuracy, precision, recall, and F1 score; Cycle 2: Use subset 2 as the validation set and subsets 1, 3-5 as the training set. Train and evaluate the model, recording the evaluation indicators. Repeat the above steps until all subsets have been used as validation sets once.

[0207] Calculate the average performance index:

[0208] The average of the accuracy, precision, recall, and F1 scores recorded in the five cycles is calculated as the final performance indicator of the model.

[0209] Evaluate the stability and generalization ability of the model: If the difference in the evaluation index of the five cycles is small, it means that the model has good stability. If the average evaluation index is high, it means that the model has good generalization ability.

[0210] This embodiment evaluates the performance of the AI ​​text detection model through a cross-validation method, and can obtain stable and reliable evaluation results. This method can help identify the performance of the model on different data sets, ensure that the model has good stability and generalization ability, and is suitable for a variety of practical application scenarios.

[0211] Furthermore, a seventh embodiment of the method for constructing an AI text detection model of the present invention is proposed, and after the above step S30, it also includes:

[0212] Step f1, obtaining the text to be detected, inputting the text to be detected into the AI ​​text detection model, and determining whether the text to be detected is AI-generated text.

[0213] In this embodiment, after obtaining the AI ​​text detection model, it is necessary to process the text to be detected to determine whether it is AI-generated text. This may include obtaining the text to be detected, preprocessing it, inputting the preprocessed text into the AI ​​text detection model, and determining the source of the text based on the output of the model. The specific steps may include:

[0214] Obtain the text to be tested: Obtain the text to be tested from various sources, such as news articles, social media posts, blog posts, etc. Make sure the text to be tested is representative and covers multiple topics and fields.

[0215] Text preprocessing: Clean and standardize the text to be tested, including removing special characters, unifying punctuation marks, converting uppercase and lowercase letters, etc. Use appropriate word segmentation tools to segment the text to be tested and generate a word list.

[0216] Text encoding: Use the vocabulary of the pre-trained BERT model to convert the tokenized word list into a corresponding token ID sequence. Add special tags (such as [CLS] and [SEP]) to indicate the beginning and end of a sentence. Generate an input ID sequence, an attention mask, and a segment ID.

[0217] Input model: Input the encoded text to be detected into the trained AI text detection model, perform forward propagation calculation, and obtain the model's prediction results.

[0218] Determine the source of the text: Determine whether the text to be tested is AI-generated based on the model's prediction results (such as classification probability or label). For example, if the classification probability output by the model is greater than a certain threshold, the text is judged to be AI-generated, otherwise it is human-created.

[0219] Example description:

[0220] Get the text to be tested: Get a social media post to be tested from the social media platform.

[0221] Text preprocessing: remove special characters, links, and advertising content from posts, and unify punctuation and capitalization. Use the THULAC word segmentation tool to segment posts and generate a word list.

[0222] Text encoding: Use the BERT vocabulary to convert a list of words into a sequence of token IDs. For example, the sentence "It's really fun to go out and play" is tokenized into ["go out", "play", "really", "happy"] and converted into a sequence of token IDs [5600, 3000, 860, 5120]. Special tags are added to generate the input ID sequence [101, 5600, 3000, 860, 5120, 102]. Generate an attention mask [1, 1, 1, 1, 1] and a segment ID [0, 0, 0, 0, 0, 0].

[0223] Input model: Input the encoded social media posts to be detected into the trained AI text detection model, perform forward propagation calculations, and obtain the model's prediction results.

[0224] Determine the source of the text: Based on the classification probability output by the model, if the probability is greater than 0.5, the post is judged to be AI-generated, otherwise it is human-created.

[0225] Through the above steps, this embodiment can efficiently and accurately determine whether the text to be detected is generated by AI. This method can be applied to various practical scenarios, such as news article detection, social media content review, blog article evaluation, etc., and has broad application prospects and good generalization ability.

[0226] The present invention also provides a device for constructing an AI text detection model.

[0227] Reference Figure 3 , Figure 3 The functional module diagram of the first embodiment of the construction device of the AI ​​text detection model of the present invention is shown in FIG. The construction device of the AI ​​text detection model includes:

[0228] A data acquisition module constructs a training data set, wherein the training data set includes text generated by AI and text created by humans, and determines a pre-trained BERT model;

[0229] A data encoding module encodes the training data in the training data set to obtain corresponding labeled data;

[0230] The model training module adds a linear layer classifier to the pre-trained BERT model to obtain an initial classifier, and trains the initial classifier using a cross entropy loss function and an optimizer and the labeled data to obtain an AI text detection model.

[0231] In addition, an embodiment of the present invention further provides a storage medium.

[0232] The storage medium stores a program for constructing an AI text detection model. When the program for constructing an AI text detection model is executed by a processor, the steps of the method for constructing an AI text detection model as described above are implemented.

[0233] The specific implementation of the storage medium of the present invention is basically the same as the various embodiments of the method for constructing the above-mentioned AI text detection model, and will not be repeated here.

[0234] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the enlightenment of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims. All equivalent structures or equivalent process changes made using the contents of the specification and drawings of the present invention, or directly or indirectly used in other related technical fields, are protected by the present invention.

[0235] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to the multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes 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 box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0236] In addition, each functional module in each embodiment of the present application can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part. If the function is implemented in the form of a software functional module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a disk or an optical disk.

[0237] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0238] The above are only various implementations 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.

Claims

1. A method for constructing an AI text detection model, characterized in that: The method for constructing the AI ​​text detection model includes the following steps: Constructing a training data set, the training data set including text generated by AI and text created by humans, and determining a pre-trained BERT model; Encoding the training data in the training data set to obtain corresponding labeled data; A linear layer classifier is added to the pre-trained BERT model to obtain an initial classifier, and the initial classifier is trained using a cross entropy loss function and an optimizer and the labeled data to obtain an AI text detection model.

2. The method for constructing an AI text detection model according to claim 1, wherein: The step of adding a linear layer classifier to the pre-trained BERT model to obtain an initial classifier comprises: The linear layer classifier is a fully connected layer classifier, and a fully connected layer classifier is added to the pre-trained BERT model to obtain the initial classifier.

3. The method for constructing an AI text detection model according to claim 1, characterized in that: The step of using the cross entropy loss function and the optimizer and the labeled data to train the initial classifier to obtain the AI ​​text detection model includes: Initializing the parameters of the initial classifier, inputting the labeled data into the initial classifier, and obtaining a prediction result; Calculating the gradient information of the parameters of the initial classifier using the cross entropy loss function and the prediction result; The optimizer updates the parameters of the initial classifier through the gradient information of the parameters of the initial classifier to obtain the AI ​​text detection model.

4. The method for constructing an AI text detection model according to claim 1, wherein: The step of encoding the training data in the training data set to obtain corresponding labeled data comprises: Determine a word segmentation tool, and use the word segmentation tool to segment sentences in the training data to generate a word list; Using the vocabulary of the pre-trained BERT model, the words in the word list are converted into corresponding labeled data.

5. The method for constructing an AI text detection model according to claim 1, wherein: The step of constructing a training data set includes: Human-created texts are obtained as positive examples, AI-generated texts are obtained as negative examples, and the same number of positive examples and negative examples are selected to construct the training data set.

6. The method for constructing an AI text detection model according to claim 1, wherein: After the step of obtaining the AI ​​text detection model, the method further includes: The performance of the AI ​​text detection model is evaluated by a cross-validation method, and the performance includes stability and generalization ability.

7. The method for constructing an AI text detection model according to claim 1, wherein: After the step of obtaining the AI ​​text detection model, the method further includes: Obtain the text to be detected, input the text to be detected into the AI ​​text detection model, and determine whether the text to be detected is AI-generated text.

8. A device for constructing an AI text detection model, characterized in that: The construction device of the AI ​​text detection model includes: A data acquisition module constructs a training data set, wherein the training data set includes text generated by AI and text created by humans, and determines a pre-trained BERT model; A data encoding module encodes the training data in the training data set to obtain corresponding labeled data; The model training module adds a linear layer classifier to the pre-trained BERT model to obtain an initial classifier, and trains the initial classifier using a cross entropy loss function and an optimizer and the labeled data to obtain an AI text detection model.

9. A device for constructing an AI text detection model, characterized in that: The AI ​​text detection model construction device includes a memory, a processor, and an AI text detection model construction program stored in the memory and executable on the processor. When the AI ​​text detection model construction program is executed by the processor, the steps of the AI ​​text detection model construction method as described in any one of claims 1 to 7 are implemented.

10. A storage medium, characterized in that: The storage medium stores a program for constructing an AI text detection model, and when the program for constructing an AI text detection model is executed by a processor, the steps of the method for constructing an AI text detection model as described in any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Intelligent auxiliary review method and system

    CN119691177A

  • Post-processing method and device for AI generated text, medium and equipment

    CN120181046A

  • Method and system for detecting AI generation text and medium

    CN120849593A

  • A method, system, and medium for detecting ai-generated text

    CN120849593B

  • Intelligent detection method and system for AI text

    CN121457470A