CN117313709A - Method for detecting generated text based on statistical information and pre-training language model - Google Patents

Method for detecting generated text based on statistical information and pre-training language model Download PDF

Info

Publication number
CN117313709A
CN117313709A CN202311614320.1A CN202311614320A CN117313709A CN 117313709 A CN117313709 A CN 117313709A CN 202311614320 A CN202311614320 A CN 202311614320A CN 117313709 A CN117313709 A CN 117313709A
Authority
CN
China
Prior art keywords
text
model
statistical
learning model
detection
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202311614320.1A
Other languages
Chinese (zh)
Other versions
CN117313709B (en
Inventor
张勇东
毛震东
徐本峰
张立成
胡博
郭子康
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
University of Science and Technology of China USTC
Original Assignee
University of Science and Technology of China USTC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by University of Science and Technology of China USTC filed Critical University of Science and Technology of China USTC
Priority to CN202311614320.1A priority Critical patent/CN117313709B/en
Publication of CN117313709A publication Critical patent/CN117313709A/en
Application granted granted Critical
Publication of CN117313709B publication Critical patent/CN117313709B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing
    • G06F40/216Parsing using statistical methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/213Feature extraction, e.g. by transforming the feature space; Summarisation; Mappings, e.g. subspace methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2415Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on parametric or probabilistic models, e.g. based on likelihood ratio or false acceptance rate versus a false rejection rate
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/243Classification techniques relating to the number of classes
    • G06F18/2431Multiple classes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/25Fusion techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/27Regression, e.g. linear or logistic regression
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • G06N3/0455Auto-encoder networks; Encoder-decoder networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/096Transfer learning

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Probability & Statistics with Applications (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Machine Translation (AREA)

Abstract

本发明涉及生成文本检测技术领域,公开了一种基于统计信息和预训练语言模型的生成文本检测方法,通过由统计学习模型、深度学习模型和动态融合框架组成的检测模型,检测生成的文本的类别标签;检测模型的构建方法包括:构建统计学习模型;构建深度学习模型;构建动态融合框架;基于训练数据集,通过计算关于动态融合得到的类别标签概率分布和真实的类别标签的交叉熵损失函数来训练检测模型。统计学习模型有效缓解了在多领域标注数据有限的情况下模型迁移性差的问题,深度学习模型摆脱了手工设计特征的问题,可以提取更加隐式的特征,动态融合框架在损失较少检测效果的前提下提高了模型的迁移能力。

The invention relates to the technical field of generated text detection, and discloses a generated text detection method based on statistical information and pre-trained language models. Through a detection model composed of a statistical learning model, a deep learning model and a dynamic fusion framework, the generated text is detected. Category label; the construction method of the detection model includes: building a statistical learning model; building a deep learning model; building a dynamic fusion framework; based on the training data set, by calculating the cross-entropy loss about the category label probability distribution obtained by dynamic fusion and the real category label function to train the detection model. The statistical learning model effectively alleviates the problem of poor model transferability in the case of limited multi-domain annotation data. The deep learning model gets rid of the problem of manually designing features and can extract more implicit features. The dynamic fusion framework loses less detection effect. Under the premise, the migration ability of the model is improved.

Description

一种基于统计信息和预训练语言模型的生成文本检测方法A generative text detection method based on statistical information and pre-trained language models

技术领域Technical field

本发明涉及生成文本检测技术领域,具体涉及一种基于统计信息和预训练语言模型的生成文本检测方法。The present invention relates to the technical field of generated text detection, and in particular to a generated text detection method based on statistical information and pre-trained language models.

背景技术Background technique

随着大规模语言模型的发展,其生成的文本越来越接近人类书写。但同时也会引发严重的安全问题,即机器生成的文本可能会被用来恶意误导人们。生成文本检测系统旨在区分文本是由机器生成还是人类生成的,近年来成为自然语言处理领域的研究热点。尽管统计学习模型不需要大量的标注数据来进行训练,同时容易迁移到新的领域中,但其检测的准确率往往较低。深度学习模型可以自动提取特征,避免了人工设计规则和特征所带来的不便以及效果依赖,且可以提取更加隐式的特征,同时可以获得更好的检测效果。但训练这些模型需要大量领域内的标注数据,同时当迁移到新的领域时,检测的效果会大幅下降。然而在许多现实场景中获取多领域高质量的标注数据通常是耗时耗力的,因此如何在有限的资源与数据下搭建性能优良的生成文本检测系统成为了一个重大挑战。With the development of large-scale language models, the text they generate is getting closer and closer to human writing. But it also raises serious security concerns, namely that machine-generated text could be used to maliciously mislead people. Generated text detection systems aim to distinguish whether text is generated by machines or humans, and has become a research hotspot in the field of natural language processing in recent years. Although statistical learning models do not require a large amount of annotated data for training and are easy to migrate to new fields, their detection accuracy is often low. The deep learning model can automatically extract features, avoiding the inconvenience and effect dependence caused by manual design rules and features, and can extract more implicit features and achieve better detection results. However, training these models requires a large amount of annotated data in the domain, and when migrating to new domains, the detection effect will drop significantly. However, in many real-life scenarios, obtaining high-quality annotation data in multiple fields is usually time-consuming and labor-intensive. Therefore, how to build a high-performance generated text detection system with limited resources and data has become a major challenge.

考虑到统计学习模型迁移性强但效果较差和深度学习模型迁移性差的情况,本发明希望将统计学习模型和深度学习模型结合,来解决多领域下生成文本检测效果差的问题。Considering that the statistical learning model has strong transferability but poor effect and the deep learning model has poor transferability, the present invention hopes to combine the statistical learning model and the deep learning model to solve the problem of poor detection effect of generated text in multiple fields.

发明内容Contents of the invention

为解决上述技术问题,本发明提供一种基于统计信息和预训练语言模型的生成文本检测方法,通过语言模型获取困惑度和词频等统计特征,通过深度学习模型提取出文本的深度特征,然后对统计特征和深度特征的预测结果分别进行概率校准,最终实现生成文本的动态融合预测。In order to solve the above technical problems, the present invention provides a generated text detection method based on statistical information and pre-trained language model. Statistical features such as perplexity and word frequency are obtained through the language model, and the deep features of the text are extracted through the deep learning model, and then the text is detected. The prediction results of statistical features and depth features are probabilistically calibrated respectively, and finally dynamic fusion prediction of generated text is achieved.

为解决上述技术问题,本发明采用如下技术方案:In order to solve the above technical problems, the present invention adopts the following technical solutions:

一种基于统计信息和预训练语言模型的生成文本检测方法,通过由统计学习模型、深度学习模型和动态融合框架组成的检测模型,检测生成的文本的类别标签;检测模型训练时采用的训练数据集记为,/>对应的标签集/>,且/>为标签集合,/>为训练数据集的长度,/>是/>对应的类别标签;文本/>是一个单词序列,/>代表第个/>文本/>中的第/>个单词,/>为文本/>的长度;A generated text detection method based on statistical information and pre-trained language models. Through a detection model composed of a statistical learning model, a deep learning model and a dynamic fusion framework, the category label of the generated text is detected; the training data used in the training of the detection model The collection is recorded as ,/> Corresponding tag set/> , and/> , is a collection of tags,/> is the length of the training data set,/> Yes/> Corresponding category label; text/> is a sequence of words ,/> Represents the No./> text/> No./> in words,/> for text/> length;

检测模型的构建方法包括:Methods for building detection models include:

步骤一,构建统计学习模型:Step 1: Build a statistical learning model:

统计学习模型采用自回归语言模型;通过自回归语言模型获取待检测的文本中每个单词的生成概率,统计文本中的单词分别出现在词汇表中前十的个数、前一百的个数/>、前一千的个数/>;基于每个单词的生成概率/>计算文本/>的概率/>,根据/>计算文本/>的困惑度/>;将、/>、/>与文本的困惑度作为统计特征,通过逻辑回归分类器,得到待检测的文本的基于统计特征预测的类别标签概率分布/>The statistical learning model uses an autoregressive language model; the autoregressive language model is used to obtain the generation probability of each word in the text to be detected. , counting the number of words in the text that appear in the top ten words in the vocabulary , the number of the first one hundred/> , the number of the first thousand/> ;Based on the generation probability of each word/> Compute text/> Probability/> , according to/> Compute text/> The degree of confusion/> ;Will ,/> ,/> The perplexity of the text is used as a statistical feature, and through the logistic regression classifier, the probability distribution of the category label predicted based on the statistical features of the text to be detected/> ;

步骤二,构建深度学习模型:Step 2: Build a deep learning model:

深度学习模型采用自编码语言模型,待检测的文本在经过自编码语言模型的编码后,将文本的起始符[CLS]的向量表示作为整个文本的语义表示,然后通过全连接网络和分类器网络得到待检测的文本的基于深度编码特征预测的类别标签概率分布/>The deep learning model uses an auto-encoding language model. After the text to be detected is encoded by the auto-encoding language model, the starting symbol [CLS] of the text is represented by a vector. As the semantic representation of the entire text, the class label probability distribution of the text to be detected based on deep coding feature prediction is obtained through the fully connected network and the classifier network/> ;

步骤三,构建动态融合框架:Step 3: Build a dynamic fusion framework:

使用标签平滑将原始的独热标签从的取值范围扩展到/>,/>是表示平滑程度的常数,增加标签平滑后预测类别的真实概率分布/>为:Use label smoothing to convert the original one-hot labels from The value range of ,/> Is a constant representing the degree of smoothness, adding the true probability distribution of the predicted category after label smoothing/> for:

;

其中代表统计学习模型和深度学习模型预测的类别标签,统计学习模型和深度学习模型的损失函数用的都是交叉熵损失函数,所以这里的/>用来对两种模型预测的类别标签进行统一指代,也可以分别用/>、/>表示。/>为真实的类别标签,K代表类别标签的总数;则检测模型的交叉熵损失函数为:in Represents the category labels predicted by the statistical learning model and the deep learning model. The loss functions of the statistical learning model and the deep learning model use the cross-entropy loss function, so here/> Used to uniformly refer to the category labels predicted by the two models, or they can also be used separately/> ,/> express. /> is the real category label, and K represents the total number of category labels; then the cross-entropy loss function of the detection model is:

;

为逻辑回归分类器和分类器网络的原始交叉熵损失,最后通过动态融合得到基于两种特征预测并动态融合的类别标签概率分布/>:/>;其中,/>、/>均为权重参数; is the original cross-entropy loss of the logistic regression classifier and classifier network, and finally through dynamic fusion, the class label probability distribution predicted and dynamically fused based on the two features/> :/> ;wherein,/> ,/> All are weight parameters;

步骤四,基于训练数据集,通过计算关于和/>的交叉熵损失函数/>来训练检测模型。Step 4: Based on the training data set, calculate the and/> The cross entropy loss function/> to train the detection model.

进一步地,步骤一中,基于每个单词的生成概率计算文本/>的概率时:Furthermore, in step 1, based on the generation probability of each word Compute text/> The probability hour:

;

其中,表示条件概率。in, represents conditional probability.

进一步地,步骤一中,根据计算文本/>的困惑度/>时:Further, in step one, according to Compute text/> The degree of confusion/> hour:

.

进一步地,步骤一中,将、/>、/>与文本的困惑度作为统计特征,通过逻辑回归分类器,得到文本的基于统计特征预测的类别标签概率分布时:Further, in step one, the ,/> ,/> With the perplexity of the text as a statistical feature, through the logistic regression classifier, the probability distribution of the class label predicted by the text based on the statistical features is obtained. hour:

;

其中,为逻辑回归分类器,/>代表拼接操作。in, is a logistic regression classifier,/> Represents the splicing operation.

进一步地,步骤二中,将文本的起始符[CLS]的向量表示作为整个文本的语义表示,并通过全连接网络和分类器网络得到待检测的文本的基于深度编码特征预测的类别标签概率分布/>时:Further, in step 2, the vector of the starting character [CLS] of the text is represented As the semantic representation of the entire text, and through the fully connected network and the classifier network, the class label probability distribution of the text to be detected based on deep coding feature prediction is obtained/> hour:

;

其中,为分类器网络的激活函数,/>是全连接网络,/>为偏置参数。in, is the activation function of the classifier network,/> It is a fully connected network,/> is the bias parameter.

与现有技术相比,本发明的有益技术效果是:Compared with the prior art, the beneficial technical effects of the present invention are:

本发明中的检测模型,包括统计学习模型、深度学习模型和动态融合框架三部分;统计学习模型提供统计特征,有效缓解了在多领域标注数据有限的情况下模型迁移性差的问题。深度学习模型摆脱了手工设计特征的问题,可以提取更加隐式的特征,预训练语言模型更是凭借其强大的编码能力提供潜在的单词间关联特征,提高了模型的检测效果。动态融合框架一方面使用标签平滑对模型进行概率校准,将模型预测的概率转换为真实的概率,另一方面也结合了统计学习模型和深度学习模型各自的优势,在损失较少检测效果的前提下大大提高了模型的迁移能力,在新领域取得了很好的检测效果,应用前景非常广阔。The detection model in the present invention includes three parts: a statistical learning model, a deep learning model and a dynamic fusion framework; the statistical learning model provides statistical features, which effectively alleviates the problem of poor model transferability when multi-domain annotation data is limited. Deep learning models get rid of the problem of manually designing features and can extract more implicit features. The pre-trained language model relies on its powerful encoding capabilities to provide potential inter-word association features, improving the detection effect of the model. On the one hand, the dynamic fusion framework uses label smoothing to perform probability calibration on the model and converts the probability predicted by the model into the real probability. On the other hand, it also combines the respective advantages of the statistical learning model and the deep learning model to achieve less loss of detection effect. This greatly improves the migration ability of the model, achieves good detection results in new fields, and has a very broad application prospect.

附图说明Description of drawings

图1为本发明实施例中的检测模型的示意图。Figure 1 is a schematic diagram of a detection model in an embodiment of the present invention.

具体实施方式Detailed ways

下面结合附图对本发明的一种优选实施方式作详细的说明。A preferred embodiment of the present invention will be described in detail below with reference to the accompanying drawings.

本发明中,训练数据集,对应的标签集/>,且/>,标签集合/>,/>表示人类,/>表示机器,/>为训练数据集的长度。文本/>是一个单词序列/>,/>代表第/>个文本/>中的第/>个单词,/>为/>的长度。任务的目标是学习一个通过/>来预测正确类别标签/>的函数/>In the present invention, the training data set , the corresponding label set/> , and/> , tag collection/> ,/> Indicates human beings,/> Indicates the machine,/> is the length of the training data set. text/> is a sequence of words/> ,/> Represents No./> text/> No./> in words,/> for/> length. The goal of the task is to learn a pass/> to predict the correct category label/> function/> .

本发明提出的检测模型如图1所示,包括以下三个部分:(1)统计学习模型;(2)深度学习模型;(3)动态融合框架。The detection model proposed by this invention is shown in Figure 1 and includes the following three parts: (1) statistical learning model; (2) deep learning model; (3) dynamic fusion framework.

(1)统计学习模型(1) Statistical learning model

统计学习模型的主体采用GPT-2之类的自回归语言模型,这是因为自回归语言模型的生成过程可以更好地模拟人类生成文本的过程。这些模型采用自回归的方式,根据先前生成的词语或标记来预测下一个词语或标记,从而逐步生成语义连贯的文本。由于语言模型倾向于采样生成概率更高的词,人类选取的词则更具有随机性。因此选择一个语言模型如GPT-2,获取每个单词的生成概率,生成概率/>表示给定前/>个单词的条件下第/>个单词的预测概率分布,以及统计文本中的单词分别出现在词汇表中前十、前一百、前一千的个数,分别表示为/>、/>、/>The main body of the statistical learning model uses autoregressive language models such as GPT-2, because the generation process of the autoregressive language model can better simulate the process of human text generation. These models use an autoregressive approach to progressively generate semantically coherent text by predicting the next word or token based on previously generated words or tokens. Since language models tend to sample words with higher probability of generation, the words selected by humans are more random. Therefore, choose a language model such as GPT-2 to obtain the generation probability of each word , generation probability/> Indicates given before/> under the condition of words/> The predicted probability distribution of words, and the number of words in the statistical text that appear in the top ten, top one hundred, and top one thousand in the vocabulary, respectively, are expressed as/> ,/> ,/> .

首先基于每个单词的生成概率计算每个文本的概率/>First calculate each text based on the generation probability of each word Probability/> :

;

由此计算每个文本的困惑度Calculate the perplexity of each text from this :

;

将得到的单词排名的统计结果与文本的困惑度作为统计特征,通过一个逻辑回归分类器,得到输入文本的基于统计特征预测的类别标签概率分布Using the obtained statistical results of word ranking and the perplexity of the text as statistical features, through a logistic regression classifier, the probability distribution of the category label predicted based on the statistical features of the input text is obtained :

;

其中为逻辑回归分类器,/>代表拼接操作。in is a logistic regression classifier,/> Represents the splicing operation.

(2)深度学习模型(2) Deep learning model

深度学习模型的主体采用BERT之类的自编码语言模型,而不是自回归语言模型,这是因为自编码语言模型通常在语言理解类任务上有更好的表现。在经过BERT等语言模型的编码后,将文本的起始符[CLS]的向量表示作为整个文本的语义表示,然后通过全连接网络和分类器网络得到输入文本的基于深度编码特征预测的类别标签概率分布/>The main body of the deep learning model uses auto-encoding language models such as BERT instead of auto-regressive language models. This is because auto-encoding language models usually perform better on language understanding tasks. After encoding by language models such as BERT, the vector representation of the text's starting symbol [CLS] is As a semantic representation of the entire text, the class label probability distribution of the input text predicted based on deep encoding features is then obtained through the fully connected network and the classifier network/> :

;

其中为分类器网络的激活函数,/>是全连接网络,/>为偏置参数。in is the activation function of the classifier network,/> It is a fully connected network,/> is the bias parameter.

(3)动态融合框架(3) Dynamic fusion framework

在进行二分类任务时,通常只关心模型的输出是否大于某一个阈值,而不关心置信度如何。然而在生成文本检测领域中,置信度的度量同样重要。模型校准目的是让模型预测概率与真实的经验概率保持一致,即将模型预测的概率尽量接近真实的概率。本发明使用标签平滑将原始的独热标签从的取值范围扩展到更大的范围,即/>,其中/>是一个较小的数,表示平滑的程度。增加标签平滑后预测类别的真实概率分布/>变为:When performing a binary classification task, we usually only care about whether the output of the model is greater than a certain threshold, and do not care about the confidence level. However, in the field of generative text detection, the measure of confidence is equally important. The purpose of model calibration is to keep the model predicted probability consistent with the real empirical probability, that is, the model predicted probability is as close as possible to the real probability. The present invention uses label smoothing to convert the original one-hot labels from The value range of is extended to a larger range, namely/> , of which/> is a small number indicating the degree of smoothness. Add the true probability distribution of the predicted category after label smoothing/> becomes:

.

其中代表统计学习模型和深度学习模型预测的类别标签,/>为真实类别标签,K代表类别的总数,本实施例中K=2。交叉熵损失函数/>改变为:in Represents the category labels predicted by statistical learning models and deep learning models, /> is the real category label, K represents the total number of categories, and K=2 in this embodiment. Cross entropy loss function/> Change to:

.

为逻辑回归分类器和分类器网络的原始交叉熵损失,最后通过动态融合得到最后的基于两种特征预测并动态融合的类别标签概率分布/> is the original cross-entropy loss of the logistic regression classifier and classifier network, and finally through dynamic fusion, the final class label probability distribution predicted and dynamically fused based on the two features/> :

;

其中,,/>,且/>,/>和/>控制了每个输入概率分布的权重,通过调整/>和/>的大小以获得最佳的结果。in, ,/> , and/> ,/> and/> Controls the weight of each input probability distribution by adjusting/> and/> size for best results.

基于训练数据集,通过计算关于和/>的优化后的交叉熵损失函数/>来训练检测模型。Based on the training data set, by calculating about and/> The optimized cross-entropy loss function/> to train the detection model.

对于本领域技术人员而言,显然本发明不限于上述示范性实施例的细节,而且在不背离本发明的精神或基本特征的情况下,能够以其他的具体形式实现本发明。因此无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本发明的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化囊括在本发明内,不应将权利要求中的任何附图标记视为限制所涉及的权利要求。It is obvious to those skilled in the art that the present invention is not limited to the details of the above-described exemplary embodiments, and the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention. Therefore, the embodiments should be regarded as illustrative and non-restrictive from any point of view. The scope of the present invention is defined by the appended claims rather than the above description, and it is therefore intended that all claims falling within the claims All changes within the meaning and scope of equivalent elements are encompassed by the present invention, and any reference signs in a claim should not be construed as limiting the claim in question.

此外,应当理解,虽然本说明书按照实施方式加以描述,但并非每个实施方式仅包含一个独立技术方案,说明书的这种叙述方式仅仅是为了清楚起见,本领域技术人员应当将说明书作为一个整体,各实施例中的技术方案也可以经适当组合,形成本领域技术人员可以理解的其他实施方式。In addition, it should be understood that although this specification is described in terms of implementations, not each implementation only contains an independent technical solution. This description of the description is only for the sake of clarity, and those skilled in the art should take the description as a whole. The technical solutions in each embodiment can also be appropriately combined to form other implementations that can be understood by those skilled in the art.

Claims (5)

1.一种基于统计信息和预训练语言模型的生成文本检测方法,通过由统计学习模型、深度学习模型和动态融合框架组成的检测模型,检测生成的文本的类别标签;检测模型训练时采用的训练数据集记为,/>对应的标签集/>,且/>,/>为标签集合,/>为训练数据集的长度,/>是/>对应的类别标签;文本/>是一个单词序列,/>代表第个/>文本/>中的第/>个单词,/>为文本/>的长度;1. A generated text detection method based on statistical information and pre-trained language models. Through a detection model composed of a statistical learning model, a deep learning model and a dynamic fusion framework, the category label of the generated text is detected; the detection model is trained using The training data set is recorded as ,/> Corresponding tag set/> , and/> ,/> is a collection of tags,/> is the length of the training data set,/> Yes/> Corresponding category label; text/> is a sequence of words ,/> Represents the No./> text/> No./> in words,/> for text/> length; 检测模型的构建方法包括:Methods for building detection models include: 步骤一,构建统计学习模型:Step 1: Build a statistical learning model: 统计学习模型采用自回归语言模型;通过自回归语言模型获取待检测的文本中每个单词的生成概率,统计文本中的单词分别出现在词汇表中前十的个数/>、前一百的个数/>、前一千的个数/>;基于每个单词的生成概率计算文本/>的概率/>,根据/>计算文本/>的困惑度/>;将、/>、/>与文本的困惑度作为统计特征,通过逻辑回归分类器,得到待检测的文本的基于统计特征预测的类别标签概率分布/>The statistical learning model uses an autoregressive language model; the autoregressive language model is used to obtain the generation probability of each word in the text to be detected. , counting the number of words in the text that appear in the top ten in the vocabulary/> , the number of the first one hundred/> , the number of the first thousand/> ;Based on the generation probability of each word Compute text/> Probability/> , according to/> Compute text/> The degree of confusion/> ;Will ,/> ,/> The perplexity of the text is used as a statistical feature, and through the logistic regression classifier, the probability distribution of the category label predicted based on the statistical features of the text to be detected/> ; 步骤二,构建深度学习模型:Step 2: Build a deep learning model: 深度学习模型采用自编码语言模型,待检测的文本在经过自编码语言模型的编码后,将文本的起始符[CLS]的向量表示作为整个文本的语义表示,然后通过全连接网络和分类器网络得到待检测的文本的基于深度编码特征预测的类别标签概率分布/>The deep learning model uses an auto-encoding language model. After the text to be detected is encoded by the auto-encoding language model, the starting symbol [CLS] of the text is represented by a vector. As the semantic representation of the entire text, the class label probability distribution of the text to be detected based on deep coding feature prediction is obtained through the fully connected network and the classifier network/> ; 步骤三,构建动态融合框架:Step 3: Build a dynamic fusion framework: 使用标签平滑将原始的独热标签从的取值范围扩展到/>,/>是表示平滑程度的常数,增加标签平滑后预测类别的真实概率分布/>为:Use label smoothing to convert the original one-hot labels from The value range of ,/> Is a constant representing the degree of smoothness, adding the true probability distribution of the predicted category after label smoothing/> for: ; 其中代表统计学习模型和深度学习模型预测的类别标签,/>为真实的类别标签,K代表类别标签的总数;则检测模型的交叉熵损失函数为:in Represents the category labels predicted by statistical learning models and deep learning models, /> is the real category label, and K represents the total number of category labels; then the cross-entropy loss function of the detection model is: ; 为逻辑回归分类器和分类器网络的原始交叉熵损失,最后通过动态融合得到基于两种特征预测并动态融合的类别标签概率分布/>:/>;其中,/>、/>均为权重参数; is the original cross-entropy loss of the logistic regression classifier and classifier network, and finally through dynamic fusion, the class label probability distribution predicted and dynamically fused based on the two features/> :/> ;wherein,/> ,/> All are weight parameters; 步骤四,基于训练数据集,通过计算关于和/>的交叉熵损失函数/>来训练检测模型。Step 4: Based on the training data set, calculate the and/> The cross entropy loss function/> to train the detection model. 2.根据权利要求1所述的基于统计信息和预训练语言模型的生成文本检测方法,其特征在于,步骤一中,基于每个单词的生成概率计算文本/>的概率/>时:2. The generated text detection method based on statistical information and pre-trained language model according to claim 1, characterized in that, in step one, based on the generation probability of each word Compute text/> Probability/> hour: ; 其中,表示条件概率。in, represents conditional probability. 3.根据权利要求1所述的基于统计信息和预训练语言模型的生成文本检测方法,其特征在于,步骤一中,根据计算文本/>的困惑度/>时:3. The generated text detection method based on statistical information and pre-trained language model according to claim 1, characterized in that, in step one, according to Compute text/> The degree of confusion/> hour: . 4.根据权利要求1所述的基于统计信息和预训练语言模型的生成文本检测方法,其特征在于,步骤一中,将、/>、/>与文本的困惑度作为统计特征,通过逻辑回归分类器,得到文本的基于统计特征预测的类别标签概率分布/>时:4. The generated text detection method based on statistical information and pre-trained language model according to claim 1, characterized in that, in step one, ,/> ,/> With the perplexity of the text as a statistical feature, through the logistic regression classifier, the probability distribution of the class label predicted based on the statistical features of the text/> hour: ; 其中,为逻辑回归分类器,/>代表拼接操作。in, is a logistic regression classifier,/> Represents the splicing operation. 5.根据权利要求1所述的基于统计信息和预训练语言模型的生成文本检测方法,其特征在于,步骤二中,将文本的起始符[CLS]的向量表示作为整个文本的语义表示,并通过全连接网络和分类器网络得到待检测的文本的基于深度编码特征预测的类别标签概率分布时:5. The generated text detection method based on statistical information and pre-trained language model according to claim 1, characterized in that, in step two, the vector of the starting symbol [CLS] of the text is represented As a semantic representation of the entire text, the class label probability distribution of the text to be detected based on deep coding feature prediction is obtained through the fully connected network and the classifier network. hour: ; 其中,为分类器网络的激活函数,/>是全连接网络,/>为偏置参数。in, is the activation function of the classifier network,/> It is a fully connected network,/> is the bias parameter.
CN202311614320.1A 2023-11-29 2023-11-29 A generative text detection method based on statistical information and pre-trained language models Active CN117313709B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311614320.1A CN117313709B (en) 2023-11-29 2023-11-29 A generative text detection method based on statistical information and pre-trained language models

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311614320.1A CN117313709B (en) 2023-11-29 2023-11-29 A generative text detection method based on statistical information and pre-trained language models

Publications (2)

Publication Number Publication Date
CN117313709A true CN117313709A (en) 2023-12-29
CN117313709B CN117313709B (en) 2024-03-29

Family

ID=89250323

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311614320.1A Active CN117313709B (en) 2023-11-29 2023-11-29 A generative text detection method based on statistical information and pre-trained language models

Country Status (1)

Country Link
CN (1) CN117313709B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117556817A (en) * 2024-01-10 2024-02-13 国开启科量子技术(安徽)有限公司 Text detection method, device, equipment and medium based on quantum circuit

Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180113856A1 (en) * 2016-10-26 2018-04-26 Abbyy Infopoisk Llc Producing training sets for machine learning methods by performing deep semantic analysis of natural language texts
US20200257943A1 (en) * 2019-02-11 2020-08-13 Hrl Laboratories, Llc System and method for human-machine hybrid prediction of events
WO2020248471A1 (en) * 2019-06-14 2020-12-17 华南理工大学 Aggregation cross-entropy loss function-based sequence recognition method
CN112214599A (en) * 2020-10-20 2021-01-12 电子科技大学 Multi-label text classification method based on statistics and pre-trained language models
US20210365773A1 (en) * 2020-05-22 2021-11-25 Element Ai Inc. Method of and system for training machine learning algorithm to generate text summary
WO2022036616A1 (en) * 2020-08-20 2022-02-24 中山大学 Method and apparatus for generating inferential question on basis of low labeled resource
US20220067558A1 (en) * 2020-09-03 2022-03-03 International Business Machines Corporation Artificial intelligence explaining for natural language processing
US20220083739A1 (en) * 2020-09-14 2022-03-17 Smart Information Flow Technologies, Llc, D/B/A Sift L.L.C. Machine learning for joint recognition and assertion regression of elements in text
CN115081437A (en) * 2022-07-20 2022-09-20 中国电子科技集团公司第三十研究所 Machine-generated text detection method and system based on linguistic feature contrast learning
US20230153546A1 (en) * 2020-07-13 2023-05-18 Ai21 Labs Controllable reading guides and natural language generation
CN116757164A (en) * 2023-06-21 2023-09-15 张丽莉 GPT generation language recognition and detection system
CN116775880A (en) * 2023-06-29 2023-09-19 重庆邮电大学 A multi-label text classification method and system based on label semantics and transfer learning
CN117131877A (en) * 2023-09-12 2023-11-28 广州木木信息科技有限公司 Text detection method and system based on contrast learning

Patent Citations (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180113856A1 (en) * 2016-10-26 2018-04-26 Abbyy Infopoisk Llc Producing training sets for machine learning methods by performing deep semantic analysis of natural language texts
US20200257943A1 (en) * 2019-02-11 2020-08-13 Hrl Laboratories, Llc System and method for human-machine hybrid prediction of events
WO2020248471A1 (en) * 2019-06-14 2020-12-17 华南理工大学 Aggregation cross-entropy loss function-based sequence recognition method
US20210365773A1 (en) * 2020-05-22 2021-11-25 Element Ai Inc. Method of and system for training machine learning algorithm to generate text summary
US20230153546A1 (en) * 2020-07-13 2023-05-18 Ai21 Labs Controllable reading guides and natural language generation
WO2022036616A1 (en) * 2020-08-20 2022-02-24 中山大学 Method and apparatus for generating inferential question on basis of low labeled resource
US20220067558A1 (en) * 2020-09-03 2022-03-03 International Business Machines Corporation Artificial intelligence explaining for natural language processing
US20220083739A1 (en) * 2020-09-14 2022-03-17 Smart Information Flow Technologies, Llc, D/B/A Sift L.L.C. Machine learning for joint recognition and assertion regression of elements in text
CN112214599A (en) * 2020-10-20 2021-01-12 电子科技大学 Multi-label text classification method based on statistics and pre-trained language models
CN115081437A (en) * 2022-07-20 2022-09-20 中国电子科技集团公司第三十研究所 Machine-generated text detection method and system based on linguistic feature contrast learning
CN116757164A (en) * 2023-06-21 2023-09-15 张丽莉 GPT generation language recognition and detection system
CN116775880A (en) * 2023-06-29 2023-09-19 重庆邮电大学 A multi-label text classification method and system based on label semantics and transfer learning
CN117131877A (en) * 2023-09-12 2023-11-28 广州木木信息科技有限公司 Text detection method and system based on contrast learning

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
李舟军;范宇;吴贤杰;: "面向自然语言处理的预训练技术研究综述", 计算机科学, no. 03, 24 March 2020 (2020-03-24) *
黄露;周恩国;李岱峰;: "融合特定任务信息注意力机制的文本表示学习模型", 数据分析与知识发现, no. 09, 9 June 2020 (2020-06-09) *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117556817A (en) * 2024-01-10 2024-02-13 国开启科量子技术(安徽)有限公司 Text detection method, device, equipment and medium based on quantum circuit
CN117556817B (en) * 2024-01-10 2024-05-24 国开启科量子技术(安徽)有限公司 Quantum circuit-based large model generation text detection method, device and equipment

Also Published As

Publication number Publication date
CN117313709B (en) 2024-03-29

Similar Documents

Publication Publication Date Title
CN110502749B (en) Text relation extraction method based on double-layer attention mechanism and bidirectional GRU
CN109657239B (en) Chinese Named Entity Recognition Method Based on Attention Mechanism and Language Model Learning
CN109992780B (en) Specific target emotion classification method based on deep neural network
CN110019839A (en) Medical knowledge map construction method and system based on neural network and remote supervisory
CN109284506A (en) A user comment sentiment analysis system and method based on attention convolutional neural network
CN111881262B (en) Text sentiment analysis method based on multi-channel neural network
CN108536754A (en) Electronic health record entity relation extraction method based on BLSTM and attention mechanism
CN108628823A (en) In conjunction with the name entity recognition method of attention mechanism and multitask coordinated training
CN108765383B (en) Video description method based on deep migration learning
CN112766359B (en) A two-dimensional Weibo rumor recognition method for food safety public opinion
CN110083833A (en) Term vector joint insertion sentiment analysis method in terms of Chinese words vector sum
CN111666758A (en) Chinese word segmentation method, training device and computer readable storage medium
CN108959474B (en) Entity relation extraction method
CN111046171B (en) Emotion discrimination method based on fine-grained labeled data
CN114722805B (en) Few-shot sentiment classification method based on knowledge distillation of big and small tutors
CN114492441A (en) BiLSTM-BiDAF Named Entity Recognition Method Based on Machine Reading Comprehension
CN108399241A (en) A kind of emerging much-talked-about topic detecting system based on multiclass feature fusion
CN115062104A (en) Knowledge prompt-fused legal text small sample named entity identification method
CN115270752A (en) A Template Sentence Evaluation Method Based on Multi-level Contrastive Learning
CN108829823A (en) A kind of file classification method
CN115203406A (en) RoBERTA model-based long text information ground detection method
CN111859979A (en) Sarcastic text collaborative recognition method, apparatus, device, and computer-readable medium
CN115114409A (en) A joint extraction method of civil aviation unsafe events based on soft parameter sharing
CN117313709A (en) Method for detecting generated text based on statistical information and pre-training language model
CN114780723B (en) Portrait generation method, system and medium based on wizard network text classification

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant