A method and system for detecting machine-modified text
By constructing a detection model that decouples mixed text features into pure style features, the problem of dependence on training data distribution in existing technologies is solved, achieving high-precision detection of machine-modified text and cross-scene applicability.
Patent Information
- Application Number
- CN202511534971.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-27
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2045-10-27
AI Technical Summary
Existing purely generated text detection methods are highly dependent on the distribution of training data when faced with machine-modified text, resulting in insufficient cross-task generalization ability and inability to adapt to cross-scenario text detection.
A detection model is constructed by decoupling mixed text features into pure style features through the construction of style separation, neutralization and consistency, and human diversity terms. Combined with the idea of contrastive learning, a detection model for machine-modified text is trained, and the detection accuracy is optimized by style alignment loss and prediction loss.
It achieves high-precision detection of machine-modified text, has good cross-scene and cross-task generalization ability, and significantly improves the discriminativeness and practicality of the detection.
Smart Images

Figure CN121009194B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of natural language processing and artificial intelligence, and more specifically to a method and system for detecting machine-modified text. Background Technology
[0002] With the widespread application of large-scale language models in tasks such as content generation, polishing, and rewriting, more and more users are introducing model assistance in their daily writing, so that some texts have both the expressive style of human language and the content generated by the model. This kind of "machine-modified text" is becoming an important part of the generated text ecosystem.
[0003] However, such auxiliary behavior is intolerable in certain fields (such as educational writing). Existing pure generation detection methods have problems such as convergence of statistical features, high dependence on training distribution, insufficient cross-task generalization ability, and difficulty in adapting to open environments when faced with machine-modified text. Furthermore, a unified and systematic technical framework has not yet been formed for dedicated detection methods for machine-modified text, and their cross-scenario robustness needs to be verified.
[0004] Existing purely generated text detection methods mainly include detection methods based on language model metrics and detection methods based on model fine-tuning, among which:
[0005] Detection methods based on language model metrics analyze the statistical features of generated text within a language model to determine its generation attributes. These methods typically rely on access to the white-box language model and utilize metrics such as output probability, word ranking, and entropy to distinguish between human-generated and machine-generated text. However, as generative models continue to improve, their ability to distinguish high-quality generated text is gradually weakening.
[0006] Model fine-tuning-based detection methods are one of the widely used techniques in current generated text recognition. The basic idea is to use human-written text and machine-generated text as supervisory signals, and then fine-tune a pre-trained language model to learn the potential differences between the two types of text in terms of semantic expression, language structure, or contextual coherence, thereby achieving classification. However, these methods generally rely on a large amount of high-quality labeled data and are highly dependent on the training distribution. They also suffer from limitations in practical applications, such as weak generalization and insufficient interpretability, in novel generative models or style-faked text scenarios.
[0007] With the widespread application of large-scale language models in tasks such as content generation, polishing, and rewriting, more and more users are introducing model assistance in their daily writing. This results in some texts possessing both human language expression styles and model-generated content. Methods for detecting machine-modified text are becoming an important part of the generated text ecosystem. Currently, only a few exploratory studies have proposed preliminary methods for detecting machine-modified text. For example, ImBD implemented the first targeted detection method for machine-modified text, identifying rewriting traces by simulating different styles and comparing the probability curvature under those style conditions. Content-expression decoupling methods decouple text into two dimensions: content and expression, constructing a two-dimensional detection framework that significantly improves detection performance across various risk levels. However, these methods have not yet formed a unified and systematic technical framework, and their adaptability to detection across multiple scenarios and models still needs further verification.
[0008] In summary, existing purely generated text detection methods are highly dependent on the distribution of training data when faced with machine-modified text, resulting in insufficient cross-task generalization ability of the model and inability to adapt to cross-scene text detection. Summary of the Invention
[0009] To address the problems existing in the above-mentioned fields, this invention proposes a method and system for detecting machine-modified text. The constructed detection model can effectively build a pure style feature space with discriminative and structural characteristics, providing a stable style expression foundation for subsequent style restoration and detection modules. By constructing the total loss, the constructed detection model can achieve high-precision detection of machine-modified text and maintain good generalization ability and practicality across scenarios and tasks.
[0010] To address the aforementioned technical problems, this invention discloses a method for detecting machine-modified text, comprising the following steps:
[0011] Obtain labeled machine-modified text and human text; preprocess the machine-modified text to obtain style-neutralized text; construct training sample pairs using the style-neutralized text and the corresponding human text.
[0012] A detection model is constructed, including a restoration model, a feature extraction module, and a classifier. Style-neutralized text is input into the restoration model to obtain restored text. The feature extraction module extracts mixed features from the style-neutralized text and restored text, and decouples the mixed features into pure style features represented by style-neutralized vectors and human style vectors. Style difference feature vectors are constructed using style-neutralized vectors and human style vectors. The three vectors are input into the classifier for classification and detection to obtain the detection results.
[0013] A style separation term is constructed based on the distance between the current style neutralization vector and the human style vector in the training sample pair; a neutralization consistency term is constructed based on the distance between the current style neutralization vector and other style neutralization vectors; a human diversity term is constructed based on the distance between the current human style vector and other human style vectors; a style alignment loss is constructed based on the distance between the human style vector and the predicted human style vector of the restored text; and a prediction loss is constructed based on the difference between the label and the detection result.
[0014] With the objectives of maximizing style separation, maximizing neutralization and consistency, maximizing human diversity, minimizing style alignment loss, and minimizing prediction loss, a detection model for machine-modified text is trained by constructing a total loss.
[0015] Preferably, the step of constructing a style separation term based on the distance between the current style neutralization vector and the human style vector in the training sample pair; constructing a neutralization consistency term based on the distance between the current style neutralization vector and other style neutralization vectors; and constructing a human diversity term based on the distance between the current human style vector and other human style vectors specifically includes:
[0016] With the objectives of maximizing the style separation term, maximizing the neutralization and consistency term, and maximizing the human diversity term, the ternary style consistency loss is constructed as follows:
[0017] ;
[0018] in, and These represent the inputs of the first and second generations. i The style neutralization vector of each training sample pair and the human style vector; , Let these represent the style neutralization vector and the human style vector, respectively, randomly sampled from the training sample pairs. This represents a vector of text pairs randomly and uniformly sampled, forming a comparison term; , , These are the margin hyperparameters for the style separation term, the neutralization and consistency term, and the human diversity term, respectively; D s D represents the style neutralization feature pool. h This represents a pool of human characteristics.
[0019] Preferably, the step of constructing the style alignment loss based on the distance between the human style vector and the corresponding real human style vector of the human text specifically includes:
[0020] The style alignment loss is constructed with the objective of minimizing the cosine distance between the human style vector and the predicted human style vector of the reconstructed text:
[0021] ;
[0022] in, To predict the human style vector of the restored text. For decoupled human style vectors.
[0023] Preferably, constructing the prediction loss based on the difference between the label and the detection result specifically includes:
[0024] Based on the token-based conditional multi-class cross-entropy loss, the semantic loss is constructed by minimizing the prediction error of the restoration model when generating restored text under stylistic and textual conditions. This means the prediction loss of the detection model is:
[0025] ;
[0026] Where T represents the length of the encoded sequence; Indicates in a given context Given the style and text x, the probability of generating the correct token for the restored text is predicted by the detection model.
[0027] Preferably, the step of training a detection model for machine-modified text by constructing a total loss, with the objectives of maximizing style separation, maximizing neutralization and consistency, maximizing human diversity, minimizing style alignment loss, and minimizing the prediction loss of the detection model, specifically includes:
[0028] The total loss is obtained by weighting the prediction loss, style alignment loss, and style triad consistency loss:
[0029] ;
[0030] in, 1. 2 and All three are weights.
[0031] Preferably, the steps of acquiring labeled machine-modified text and human text; preprocessing the machine-modified text to obtain style-neutralized text; and constructing training sample pairs using the style-neutralized text and the corresponding human text specifically include:
[0032] By using the DeepSeek large language model, style guidance prompts are designed to guide the DeepSeek large language model to remove style bias content in the input machine-modified text and transform the machine-modified text into style-neutral text.
[0033] Label the style neutral text and human text separately, and obtain text pairs of labeled style neutral text and corresponding human text as training sample pairs;
[0034] Define style neutralization feature pool D s and human characteristic pool D h They are respectively:
[0035] ;
[0036] in, They represent from the first i The style neutralization vector and the human style vector in each training sample pair;
[0037] By style neutralization feature pool D s and human characteristic pool D h We collect style neutralization vectors and human style vectors from the training sample pairs, respectively.
[0038] Preferably, the feature extraction module includes a hybrid feature extraction module, a feature decoupling module, and a feature difference construction module, specifically including:
[0039] The mixed feature extraction module extracts mixed features of style-neutralized text and restored text;
[0040] The feature decoupling module decouples the hybrid features into pure style features represented by style neutralization vectors and human style vectors;
[0041] The feature difference construction module is used to construct style difference feature vectors from style neutralization vectors and human style vectors.
[0042] Preferably, the step of inputting three vectors into a classifier for classification and detection to obtain detection results specifically includes:
[0043] The constructed style difference feature vector, style neutralization vector, and human style vector are concatenated to obtain a comprehensive detection feature vector.
[0044] The comprehensive detection feature vector is input into a lightweight classifier, which learns to restore the style difference features of the text to achieve the final detection and obtain the detection result.
[0045] Preferably, it also includes a machine-modified text detection system, comprising:
[0046] The dataset construction module is used to obtain labeled machine-modified text and human text; the machine-modified text is preprocessed to obtain style-neutralized text; and training sample pairs are constructed using the style-neutralized text and the corresponding human text.
[0047] The detection model construction module is used to build the detection model, including a restoration model, a feature extraction module, and a classifier. Style-neutralized text is input into the restoration model to obtain restored text. The feature extraction module extracts mixed features from the style-neutralized text and restored text, and decouples these mixed features into pure style features represented by style-neutralized vectors and human style vectors. A style difference feature vector is constructed using the style-neutralized vector and the human style vector. The three vectors are then input into the classifier for classification and detection to obtain the detection results.
[0048] The loss function construction module is used to construct a style separation term based on the distance between the current style neutralization vector and the human style vector in the training sample pair; a neutralization consistency term based on the distance between the current style neutralization vector and other style neutralization vectors; a human diversity term based on the distance between the current human style vector and other human style vectors; a style alignment loss based on the distance between the human style vector and the human style vector of the predicted restored text; and a prediction loss based on the difference between the label and the detection result.
[0049] The detection module aims to maximize the style separation term, maximize the neutralization and consistency term, maximize the human diversity term, minimize the style alignment loss, and minimize the prediction loss. By constructing the total loss, it trains a detection model for machine-modified text.
[0050] Compared with the prior art, the present invention has the following beneficial effects:
[0051] The machine-modified text detection method proposed in this invention overcomes the technical shortcomings of existing technologies, such as the strong dependence on the distribution of model training data, which leads to inaccurate detection. The constructed detection model decouples the mixed feature representation of text into pure style features by maximizing style separation, neutralization consistency, and human diversity. This simultaneously achieves the triple constraints of "style separation, neutralization consistency, and human diversity," innovatively combining contrastive learning. By optimizing the decoupling process of mixed feature representation, it effectively constructs a pure style feature space with discriminative and structural characteristics, significantly improving the discriminative power of style features and providing a stable style representation foundation for subsequent style restoration and detection modules. Secondly, a style alignment loss is constructed based on the distance between the human style vector and the predicted human style vector of the restored text. This guides the model to output vector representations with a style consistent with human text when generating text, thereby achieving high-precision detection of style-neutralized text and maintaining good generalization ability and practicality across scenarios and tasks. Attached Figure Description
[0052] Figure 1 This is a flowchart of the machine-modified text detection method proposed in this invention;
[0053] Figure 2 A schematic diagram of the machine-modified text detection framework provided in an embodiment of the present invention;
[0054] Figure 3 The overall network architecture diagram of the inverse style restoration model provided in the embodiments of the present invention. Detailed Implementation
[0055] The following will refer to the appendices in the embodiments of the present invention. Figures 1-3 The technical solutions in the embodiments of the present invention will be clearly and completely described. It should be understood that the terminology used in the present invention is only for describing particular implementation methods and is not intended to limit the present invention.
[0056] Example
[0057] like Figure 1 As shown, this invention proposes a method for detecting machine-modified text, comprising the following steps:
[0058] S1: Obtain labeled machine-modified text and human text; preprocess the machine-modified text to obtain style-neutralized text; construct training sample pairs using the style-neutralized text and the corresponding human text.
[0059] S2: Construct a detection model, including a restoration model, a feature extraction module, and a classifier; input the style-neutralized text into the restoration model to obtain the restored text; extract the mixed features of the style-neutralized text and the restored text through the feature extraction module, and decouple the mixed features into pure style features represented by style-neutralized vectors and human style vectors, and construct style difference feature vectors through style-neutralized vectors and human style vectors; input the three vectors into the classifier for classification and detection to obtain the detection results;
[0060] S3: Construct a style separation term based on the distance between the current style neutralization vector and the human style vector in the training sample pair; construct a neutralization consistency term based on the distance between the current style neutralization vector and other style neutralization vectors; construct a human diversity term based on the distance between the current human style vector and other human style vectors; construct a style alignment loss based on the distance between the human style vector and the predicted human style vector of the restored text; construct a prediction loss based on the difference between the label and the detection result.
[0061] S4: With the objectives of maximizing the style separation term, maximizing the neutralization and consistency term, maximizing the human diversity term, minimizing the style alignment loss, and minimizing the prediction loss, a detection model for machine-modified text is trained by constructing a total loss.
[0062] like Figure 2 As shown, this invention provides a machine-modified text detection framework, MRTDF, which includes two core processes: Figure 2 Figure (a) in the figure shows the training process for generating pure style features through decoupling; Figure 2 Figure (b) in the figure is a flowchart of style shift detection, which is used to perform style difference analysis on the machine-modified and restored text to achieve the final style shift detection.
[0063] The present invention will now be described in further detail from three aspects: style neutralization, restoration model, and style shift detection method.
[0064] Style neutralization is a fundamental preprocessing step proposed in this invention for machine-modified text. Its core objective is to eliminate decorative style features in the text (such as tone, word preference, complex sentence structure, etc.) while retaining its semantic core information. This provides a consistent feature foundation for subsequent inverse style restoration models and the training process of generating pure style features, including style neutralization vectors and human style vectors, through decoupling.
[0065] In its implementation, this invention employs DeepSeek, a large language model with style expression and understanding capabilities, and designs style guidance prompts to guide DeepSeek to remove style-biased content from the input machine-modified text and transform it into style-neutral text.
[0066] This embodiment constructs a restoration model to restore the style of the style-neutralized text and generates the restored text corresponding to the style-neutralized text.
[0067] This invention provides a restoration mechanism based on style-neutralized text, combined with style-aware supervision and semantic generation optimization. This restoration model can output pure style features with significant inter-class separability, and inject style-neutralized text into human text to detect machine-modified text.
[0068] Specifically, such as Figure 3 As shown, this is the restoration model provided in an embodiment of the present invention. The restoration model takes text pairs of style neutral text and corresponding human text as input, and gradually guides the restoration model to reconstruct the style features of the target human text, thereby realizing the restoration of the real human style and providing a style-separable feature basis for subsequent style difference detection.
[0069] The overall structure of the restored model includes a hybrid feature extraction module, a feature decoupling module (SDM), a feature difference construction module (FAM), and a style shift detection module, among which:
[0070] The mixed feature extraction module extracts mixed features of the style neutral text SNT and its corresponding human text HWT.
[0071] By using the pre-trained model Deberta in the mixed feature extraction module, the mixed features of the text pairs are extracted as follows:
[0072] ;
[0073] in, This represents the 768-dimensional hybrid feature representation of style-neutral text and human text extracted by Deberta, respectively. This indicates the encoder function that uses Deberta to extract features.
[0074] In the feature decoupling module, the hybrid feature representation is decoupled into pure style features represented by style neutralization vectors and human style vectors; the decoupling process of hybrid features is optimized by constructing a three-point consistency loss function.
[0075] Specifically, the decoupled style neutralization features and human text features are denoted as follows: And obtain style neutralization vectors and human style vectors; and construct a style neutralization feature pool D s and human characteristic pool D h Collect the style neutralization vector and human style vector from the training sample pairs respectively:
[0076] Defined style neutralization feature pool D s and human characteristic pool D h They are respectively:
[0077] ;
[0078] in, They represent the first i The style neutralization vector and the human style vector in each training sample pair.
[0079] To achieve style structure decoupling and discriminative modeling, this invention optimizes the decoupling process of hybrid feature representation by constructing a style three-point consistency loss, thereby decoupling pure style features and effectively constructing a pure style feature space with discriminative and structural characteristics, providing a stable style expression foundation for subsequent style restoration and detection modules.
[0080] By constructing a three-point consistency loss function that aims to maximize style separation, neutralization consistency, and human diversity, the decoupling process of mixed features is optimized.
[0081] A style separation term is constructed based on the distance between the current style neutralization vector and the human style vector; a neutralization consistency term is constructed by determining the distance between other style neutralization vectors and the style center, with the current style neutralization vector as the style center; a human diversity term is constructed based on the distance between the current human style vector and other human style vectors.
[0082] The style three-point consistency loss function, STC-Loss, is as follows:
[0083] ;
[0084] in, and Indicates the input number of the first... i The style neutralization vector of each training sample pair and the human style vector; , Let these represent the style neutralization vector and the human style vector, respectively, randomly sampled from the training sample pairs. This means that a text pair vector is randomly and uniformly sampled to form a comparison term; , , These are the margin hyperparameters for the style separation term, the neutralization and consistency term, and the human diversity term, respectively.
[0085] With the goals of maximizing style separation, neutralization consistency, and human diversity, the style separation term increases the distance between the style neutralization vector and the human style vector in the current text pair. The neutralization consistency term constrains other style neutralization vectors under different semantics to converge to the style center, thus achieving style aggregation. The human diversity term increases the distance between the current human style vector and other human style vectors, thus preserving style diversity.
[0086] By training the MPL mapping layer network using the style three-point consistency loss function, the decoupling process of the reconstruction model can decouple 128-dimensional pure style features that can represent the style from the 768-dimensional mixed feature representation.
[0087] To achieve effective transfer of style generation capabilities, a style alignment loss is constructed based on the distance between the human style vector and the predicted human style vector of the reconstructed text, guiding the model to output style feature vectors with a consistent style with the human text when generating the reconstructed text.
[0088] Specifically, with the goal of minimizing the cosine distance between the human style vector and the predicted human style vector of the restored text, a style alignment loss is constructed to make the human style vector of the restored text obtained by the restoration model more human writing style.
[0089] The constructed style alignment loss is:
[0090] ;
[0091] in, To predict the human style vector of the restored text. For decoupled human style vectors.
[0092] The Token-based Conditional Multi-Class Cross-Entropy Loss (CE Loss) aims to minimize the prediction error of the detection model when generating restored text under both style and textual conditions. The constructed prediction loss is as follows:
[0093] ;
[0094] Where T represents the length of the sequence, Indicates in a given context Given the style and text x, the detection model predicts the probability of generating the correct token for the restored text.
[0095] The prediction loss, style alignment loss, and style triad consistency loss are weighted to obtain the total loss, TotalLoss:
[0096] ;
[0097] in, 1. 2 and All three are weights.
[0098] Weight 1. 2 and The adjustment strategy of 3 adopts a semantic-first, style-gradual training approach. In the early stage, more attention is paid to semantic loss, and as training progresses, the weight of style loss gradually increases.
[0099] Figure 3 h h and h r These represent the hidden state features encoded by the last token of the human text in the input prompt extracted by the restoration model and the restored text in the output response, respectively, in the last transformer layer. In the decoder, Logits refer to the raw scores or the output without activation functions before passing through the last fully connected layer. These scores are typically learned by the neural network and represent the model's predicted probability for each category.
[0100] This invention introduces a low-rank adaptation mechanism and implements a semantic-first, style-gradual optimization strategy to efficiently fine-tune the parameters of the detection model and train the detection model, thereby achieving the reverse restoration of style-neutral text to human-style text.
[0101] In the style shift detection module, in order to train a lightweight classifier for style difference detection, this invention determines the style difference vector between the style neutralization vector and the human style vector.
[0102] The style neutralization vector, human style vector, and style difference vector are fused (vector concatenation) to obtain the final comprehensive detection feature vector:
[0103] ;
[0104] in, Indicates the first i The style neutralization vector of each training sample pair Indicates the first i Human style vectors for each training sample pair This is a style difference vector.
[0105] The concatenated 384-dimensional comprehensive detection feature vector is input into a lightweight classifier, which learns to restore the style difference features of the text to achieve the final detection.
[0106] The text detection method proposed in this invention can quantify and utilize the style difference features of text pairs. With the goal of maximizing the style separation term, maximizing the neutralization and consistency term, maximizing the human diversity term, minimizing the style alignment loss, and minimizing the prediction loss of the detection model, the total loss is constructed. By optimizing the decoupling process of mixed features, the constructed detection model is further optimized, which can achieve high-precision detection of style-neutral texts and maintain good generalization ability and practicality across scenarios and tasks.
[0107] This invention also proposes a machine-modified text detection system, comprising:
[0108] The dataset construction module is used to obtain labeled machine-modified text and human text; the machine-modified text is preprocessed to obtain style-neutralized text; and training sample pairs are constructed using the style-neutralized text and the corresponding human text.
[0109] The detection model construction module is used to build the detection model, including a reconstruction model, a feature extraction module, and a classifier. Style-neutralized text is input into the reconstruction model to obtain the reconstructed text. The feature extraction module extracts mixed features from the style-neutralized text and the reconstructed text, and decouples these mixed features into pure style features represented by style-neutralized vectors and human style vectors. A style difference feature vector is constructed using the style-neutralized vector and the human style vector. The three vectors are then input into the classifier for classification and detection to obtain the detection results.
[0110] The loss function construction module is used to construct a style separation term based on the distance between the current style neutralization vector and the human style vector in the training sample pair; a neutralization consistency term based on the distance between the current style neutralization vector and other style neutralization vectors; a human diversity term based on the distance between the current human style vector and other human style vectors; a style alignment loss based on the distance between the human style vector and the human style vector of the predicted restored text; and a prediction loss based on the difference between the label and the detection result.
[0111] The detection module aims to maximize the style separation term, maximize the neutralization and consistency term, maximize the human diversity term, minimize the style alignment loss, and minimize the prediction loss of the detection model. By constructing the total loss, it trains a detection model for machine-modified text.
[0112] The machine-modified text detection method proposed in this invention demonstrates significant advantages in detection accuracy, robustness, and versatility. To verify its effectiveness, experiments were conducted on multiple high-quality datasets, covering two typical scenarios: machine-modified text detection and machine-generated text detection.
[0113] In the machine-modified text detection task, the AI-Revised subset of the MixSet dataset was selected for experiments. The style-neutralized text in this dataset was generated after undergoing word-level polishing (Polish-Tok), sentence reconstruction (Polish-Sen), semantic rewriting (Rewrite), and content completion (Complete) operations using two mainstream large models (Llama2 and GPT-4), demonstrating strong realism and operational diversity. Comparison methods included Fast-DetectGPT based on a perturbation scoring mechanism, the supervised training method RoBERTa-large, and the ImBD method for optimizing style probability curvature.
[0114] The experimental results are shown in Table 1. Compared with the Fast-DetectGPT, RoBERTa-large, and ImBD detection methods, the machine-modified text detection framework MRTDF provided in this embodiment of the invention improves the average performance of the AUC index for different text modification methods by 34.95%, 10.55%, and 23.57%, respectively. These results demonstrate that the machine-modified text detection method proposed in this invention can achieve higher detection accuracy in various complex rewriting tasks.
[0115] Table 1. AUC Performance Evaluation of Machine-Modified Text Detection Task
[0116]
[0117] To further verify the universality and robustness of the detection method proposed in this invention, extended experiments were conducted on machine-generated text tasks. The machine-generated data used in the experiments came from the DetectRL dataset, covering four types of HWT sources: academic writing, news reports, creative writing, and social media comments. The data was generated using various large-scale language models (such as ChatGPT and Claude-Instant) to ensure diversity and representativeness.
[0118] Table 2. AUC and F1 performance of different detection methods on the generated text detection task.
[0119]
[0120] The results are shown in Table 2. Compared with Fast-DetectGPT, the machine-modified text detection framework MRTDF method improved the AUC by 10.23% and the F1 score by 15.53%; compared with ImBD, it improved by 5.04% and 9.10% respectively; and compared with RoBERTa-large, it improved by 10.49% and 14.11% respectively. These results further verify the good robustness of the present invention in fully generated text detection scenarios.
[0121] In summary, the machine-modified text detection method proposed in this invention maintains excellent performance and wide applicability in detection tasks under different levels of involvement and multiple text types.
[0122] The above description is only a preferred embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any equivalent substitutions or modifications made by those skilled in the art within the scope of the technology disclosed in the present invention, based on the technical solution and inventive concept of the present invention, should be covered within the scope of protection of the present invention.
[0123] Furthermore, unless otherwise stated, all technical and scientific terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. All references to this specification are incorporated by way of citation to disclose and describe methods relating to those references. In the event of any conflict with any incorporated reference, the content of this specification shall prevail.
Claims
1. A method of detecting machine-modified text, the method comprising: The method comprises the following steps: obtaining machine-modified text and human text with labels; preprocessing the machine-modified text to obtain style-neutral text; constructing a training sample pair from the style-neutral text and the corresponding human text; constructing a detection model, including a restoration model, a feature extraction module, and a classifier; inputting the style-neutral text into the restoration model to obtain restored text; extracting mixed features of the style-neutral text and the restored text through the feature extraction module, and decoupling the mixed features into pure style features represented by a style-neutral vector and a human style vector, and constructing a style difference feature vector from the style-neutral vector and the human style vector; inputting the three vectors into the classifier for classification detection to obtain a detection result; constructing a style separation term according to the distance between the current style-neutral vector and the human style vector in the training sample pair; constructing a neutral consistency term according to the distance between the current style-neutral vector and other style-neutral vectors; constructing a human diversity term according to the distance between the current human style vector and other human style vectors; constructing a style alignment loss according to the distance between the human style vector and the predicted human style vector of the restored text; and constructing a prediction loss according to the difference between the label and the detection result; maximizing the style separation term, the neutral consistency term, and the human diversity term, minimizing the style alignment loss, and minimizing the prediction loss as the target, constructing a total loss to train the detection model for the machine-modified text.
2. The method of claim 1, wherein, The construction of the style separation term, the neutral consistency term, and the human diversity term according to the distance between the current style-neutral vector and the human style vector in the training sample pair, the distance between the current style-neutral vector and other style-neutral vectors, and the distance between the current human style vector and other human style vectors, specifically includes: maximizing the style separation term, the neutral consistency term, and the human diversity term as the target, and constructing a style ternary consistency loss as: ; wherein, with respectively denote the style-in and style-out vectors of the i-th input training sample pair and the human style vector; i , , respectively denote the randomly sampled style-in and style-out vectors from the training sample pair and the human style vector; denotes a randomly uniformly sampled text pair vector, constituting a contrastive term; , , are margin hyperparameters corresponding to the style separation term, the neutral consistency term and the human diversity term respectively; D s denotes the style neutral feature pool, D h denotes the human feature pool.
3. The method of claim 1, wherein, The construction of the style alignment loss according to the distance between the human style vector and the predicted human style vector of the restored text specifically includes: minimizing the cosine distance between the human style vector and the predicted human style vector of the restored text as the target, and constructing a style alignment loss as: ; wherein, is a predicted human style vector for the reduced text, is a decoupled human style vector.
4. The method of claim 1, wherein, The construction of the prediction loss according to the difference between the label and the detection result specifically includes: a Token-based conditional multi-class cross-entropy loss, which minimizes the prediction error of the detection model when generating the restored text under the condition of the style-neutral text, and constructs a prediction loss as: ; where T represents the length of the encoded sequence; represents the probability of generating the correct Token of the restored text by the detection model, given the context and style, and the conditions of the text x.
5. The method of claim 1, wherein, The training of the detection model for the machine-modified text by maximizing the style separation term, the neutral consistency term, and the human diversity term, minimizing the style alignment loss, and minimizing the prediction loss as the target, and constructing a total loss specifically includes: weighting the prediction loss, the style alignment loss, and the style ternary consistency loss to obtain a total loss as: ; wherein 1, 2 and 3 are weights.
6. The method of claim 1, wherein, obtaining machine-modified text and human text with labels; preprocessing the machine-modified text to obtain style-neutral text; constructing a training sample pair from the style-neutral text and the corresponding human text, specifically including: The style neutralization text is obtained by guiding a large language model DeepSeek to remove style bias content in the input machine modified text through a design style guide prompt word, and the machine modified text is converted into the style neutralization text. The style neutralization text and the human text are respectively labeled to obtain a text pair of the labeled style neutralization text and the corresponding human text as a training sample pair. Definition style and feature pool D s and human feature pool D h respectively: ; wherein, respectively represent a style sampled from the first i and the second training sample pair and a vector to the human style vector; by style neutralizing feature pool D s and human feature pool D h , respectively, collect the style neutralizing vector and the human style vector in the training sample pair.
7. The method of claim 1, wherein, The feature extraction module includes a mixed feature extraction module, a feature decoupling module and a feature difference construction module, and specifically includes: The mixed feature extraction module extracts mixed features of the style neutralization text and the restored text; The feature decoupling module decouples the mixed features into pure style features represented by a style neutralization vector and a human style vector; The feature difference construction module is used to construct a style difference feature vector through the style neutralization vector and the human style vector.
8. The method of claim 1, wherein, The three vectors are input into the classifier for classification detection to obtain a detection result, and specifically includes: The constructed style difference feature vector, the style neutralization vector and the human style vector are spliced to obtain a comprehensive detection feature vector; The comprehensive detection feature vector is input into a lightweight classifier to realize final detection of the style difference features of the restored text through learning, and a detection result is obtained.
9. A system for detecting machine-modified text, the system comprising: It includes: The data set construction module is used to obtain labeled machine modified text and human text; The machine modified text is preprocessed to obtain the style neutralization text; The training sample pair is constructed from the style neutralization text and the corresponding human text; The detection model construction module is used to construct a detection model, including a restoration model, a feature extraction module and a classifier; the style neutralization text is input into the restoration model to obtain a restored text; the mixed features of the style neutralization text and the restored text are extracted through the feature extraction module, and the mixed features are decoupled into pure style features represented by a style neutralization vector and a human style vector, and a style difference feature vector is constructed through the style neutralization vector and the human style vector; the three vectors are input into the classifier for classification detection to obtain a detection result; The loss function construction module is used to construct a style separation term according to the distance between the current style neutralization vector and the human style vector in the training sample pair; a neutralization consistency term is constructed according to the distance between the current style neutralization vector and other style neutralization vectors; a human diversity term is constructed according to the distance between the current human style vector and other human style vectors; a style alignment loss is constructed according to the distance between the human style vector and the predicted human style vector of the restored text; and a prediction loss is constructed according to the difference between the label and the detection result; The detection module is used to maximize the style separation term, the neutralization consistency term, the human diversity term, minimize the style alignment loss and the prediction loss, and train to obtain a detection model for machine modified text through construction of a total loss.
Citation Information
Patent Citations
Multi-field false news detection method based on emotion-style depolarization
CN117828029A
Generated text source detection method based on writing style
CN118446202A