A machine-generated text detection method, system, device, and medium
By performing sentence segmentation and structural perturbation recovery on machine-generated text, and combining multi-dimensional structural indicators and encoder-decoder structures, the problem of low detection accuracy in existing technologies is solved, and efficient recognition of polished or rewritten text is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HEBEI UNIVERSITY
- Filing Date
- 2026-04-17
- Publication Date
- 2026-05-29
AI Technical Summary
Existing machine-generated text detection methods struggle to maintain good detection performance when faced with edited or rewritten text, resulting in low detection accuracy.
By segmenting the input text into sentences, perturbation strategies and intensity are selected based on multi-dimensional structural indicators to perturb the structure of sentence-level units. The text structure is restored using an encoder-decoder structure, and binary classification is performed by combining multi-source features. The training is carried out using an end-to-end joint optimization objective function.
It effectively improves the stability and robustness of machine-generated text recognition, maintaining high recognition accuracy and reducing false positives in complex camouflage scenarios.
Smart Images

Figure CN122116002A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of natural language processing, and specifically relates to a method, system, device and medium for detecting machine-generated text. Background Technology
[0002] With the rapid development and widespread application of large-scale language models, the quality and fluency of machine-generated text have approached, and in some scenarios even surpassed, human capabilities. While this progress has improved productivity, it has also brought serious challenges in areas such as information authenticity verification, copyright ownership determination, and content security control. Therefore, how to accurately and reliably distinguish between human-written text and machine-generated text has become a crucial and highly relevant research topic in the fields of natural language processing and data security.
[0003] Existing generative text detection methods, primarily supervised learning-based classification and detection approaches, typically use pre-trained language models (such as BERT and RoBERTa) as feature extractors. These models learn static semantic differences in text through labeled samples to distinguish between human-generated and machine-generated text. Within the training distribution, these methods achieve high detection accuracy, but they have limited sensitivity to structural camouflage and struggle to handle text deformations across domains or from unknown generative models. Especially after text polishing or paraphrasing, structural cues are significantly weakened, easily leading to a decline in the discriminative performance of existing methods.
[0004] In summary, in complex scenarios, when machine-generated text is polished or rewritten, its surface linguistic features are highly similar to human text. Existing technologies struggle to maintain good detection performance in complex camouflaged scenarios, resulting in low detection accuracy for machine-polished text. Summary of the Invention
[0005] To address the issue of low detection accuracy of machine-edited text, this invention provides a method, system, device, and medium for detecting machine-generated text.
[0006] To achieve the above objectives, the present invention provides the following technical solution: A first aspect of this invention provides a machine-generated text detection method, comprising the following steps: Acquire the input text data and divide the input text data into multiple sentence-level units; Based on a multidimensional structural index for evaluating text structural attributes, a perturbation strategy and its corresponding perturbation intensity are selected from a predefined strategy space to perturb the structure of sentence-level units, generating perturbed text with disrupted structure. The perturbation text is input into an encoder-decoder structure based on a pre-trained language model. The original text data is used as the supervision target. The encoder extracts the perturbation vectors that represent structural destruction features in the perturbation text. The decoder performs autoregressive structural recovery on the perturbation vectors to generate reconstructed text and extracts the reconstructed vectors that represent structural recovery behavior features in the reconstructed text. The original semantic features extracted from the input text data are concatenated and fused with the perturbation vector and the recombined vector; a binary classification is performed based on the fused feature vector to output the detection result of whether the input text data is machine-generated.
[0007] Furthermore, in the process of selecting perturbation strategies and corresponding perturbation intensities from a predefined strategy space to perform structural perturbation on sentence-level units based on the multidimensional structural index that evaluates text structural attributes, the process also includes using four layers of structural perception units to apply structural intervention to sentence-level units from different levels. Among them, the first layer of structural perception unit focuses on sentence order and overall complexity changes; the second layer of structural perception unit focuses on syntactic structure intervention; the third layer of structural perception unit focuses on lexical layer intervention; and the fourth layer of structural perception unit focuses on discourse-level logical perturbation. Each layer of structural perception unit is guided by a corresponding structural index to select a perturbation strategy from the strategy space and determine the perturbation intensity.
[0008] Furthermore, a differentiable policy selection mechanism based on Gumbel-Softmax is used to select perturbation policies and corresponding perturbation intensities from a predefined policy space to perform structural perturbation on sentence-level units. In the differentiable policy selection mechanism, for each structure-aware layer, the structural indices are encoded into vectors, and then the logits vector of the candidate policy set is output through a lightweight network. Continuous relaxation of the policy distribution is achieved through Gumbel-Softmax sampling, and policy diversity is maintained through an entropy regularization term; wherein, the policy distribution Represented as: ; in, For noise from the Gumbel distribution, For temperature parameters; The entropy regularization term Represented as: ; in, N For batch size, i This is the index of the samples in the batch. j For strategy indexing, For the first i The first sample selection j The probability of a perturbation strategy.
[0009] Furthermore, the strategy space includes sentence order perturbation, intra-sentence structure transformation, voice conversion, and lexical substitution.
[0010] Furthermore, the multidimensional structural indicators include sentence order complexity, syntactic structure complexity, lexical diversity, and discourse logical coherence.
[0011] Furthermore, it also includes end-to-end joint training of the structural perturbation process, the structural recovery and reconstruction process, and the binary classification process through a joint optimization objective function; the joint optimization objective function is expressed as: ; in, This represents the joint optimization objective function. L cls For classifying losses, L rec For restructuring losses, L entropy For entropy regularization, To control the weight of restructuring losses, To adjust the strength of the entropy regularization term.
[0012] A second aspect of the present invention provides a machine-generated text detection system, comprising: The text acquisition module is used to acquire input text data and divide the input text data into multiple sentence-level units. The structural perturbation module is used to select perturbation strategies and corresponding perturbation intensities from a predefined strategy space based on multidimensional structural indicators that evaluate the structural attributes of text, and to perturb sentence-level units to generate perturbed text with disrupted structure. The structure reconstruction module is used to input perturbed text into an encoder-decoder structure based on a pre-trained language model. With the original text data as the supervision target, the encoder extracts perturbation vectors that represent structural destruction features from the perturbed text, and the decoder performs autoregressive structure recovery on the perturbation vectors to generate reconstructed text and extract reconstructed vectors that represent structural recovery behavior features from the reconstructed text. The discrimination module is used to concatenate and fuse the original semantic features extracted from the input text data with the perturbation vector and the recombined vector; and to perform binary classification based on the fused feature vector to output the detection result of whether the input text data is machine-generated.
[0013] A third aspect of the present invention provides a readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.
[0014] A fourth aspect of the present invention provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described method.
[0015] The machine-generated text detection method provided by this invention has the following beneficial effects: By segmenting the input text into sentences, a foundation is laid for subsequent sentence-level structural operations, effectively improving processing efficiency and the targeted nature of structural modeling. Then, a structural perturbation module applies controlled structural disruption to sentence units, simulating text being subjected to rewriting, polishing, and other disguised attacks, thereby exposing the vulnerability of machine text in its deep structure. Next, a structural reconstruction module restores the perturbated text, extracting the perturbation vector output by the encoder and the reconstruction vector output by the decoder during this process. This crucial step explicitly captures the dynamic structural change trajectory of the text during the "disruption-recovery" process, generating a stable feature with strong discriminative power against both human and machine text. Finally, based on these dynamic structural features, a classifier is used for discrimination, enabling this invention to fundamentally overcome the dependence on static semantics or probability distributions, thus maintaining extremely high recognition stability and robustness even when faced with complexly disguised machine-generated text. Attached Figure Description
[0016] To more clearly illustrate the embodiments and design schemes of the present invention, the accompanying drawings required for this embodiment will be briefly described below. The drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0017] Figure 1 This is a flowchart illustrating the machine-generated text detection method in an embodiment of the present invention; Figure 2 This is a schematic diagram of the strategy selection and disturbance module structure in an embodiment of the present invention; Figure 3 This is a schematic diagram of the recombination module structure in an embodiment of the present invention; Figure 4 This is a schematic diagram of the classifier structure in an embodiment of the present invention. Detailed Implementation
[0018] To enable those skilled in the art to better understand and implement the technical solutions of the present invention, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. The following embodiments are only used to more clearly illustrate the technical solutions of the present invention and should not be construed as limiting the scope of protection of the present invention.
[0019] In the description of this invention, it should be understood that the terms "first," "second," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance. In the description of this invention, it should be noted that unless otherwise explicitly stated or limited, those skilled in the art can understand the specific meaning of the above terms in this invention according to the specific circumstances. In the description of this invention, unless otherwise stated, "a plurality of" means two or more, which will not be elaborated further here.
[0020] Existing machine-generated text detection methods mostly rely on static semantic features or conditional probability distributions of language models for recognition. When text is rewritten, polished, or its sentence structure is adjusted, the structural information changes, and the recognition criteria change, leading to a decline in detection performance. To address these issues, a detection method is needed that can effectively model the dynamic changes in text structure and maintain stable performance under camouflaged interference conditions. This invention is based on structural perturbation and reconstruction. Its core is to apply controllable structural perturbations to the input text and then explicitly capture the structural recovery trajectory through a reconstruction process. This trajectory is used to construct a dynamic structural feature representation, achieving effective differentiation between human text and machine-generated text, maintaining high recognition stability and misjudgment control even when facing polished text scenarios.
[0021] The technical solutions provided by the various embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0022] First, such as Figure 1 As shown, this invention proposes a machine-generated text detection method. This method aims to distinguish between human-written text and machine-generated text, following a technical path of "perturbation-reconstruction-discrimination." The overall process includes four main stages: text preprocessing, structural perturbation, structural reconstruction, and classification. The method specifically includes the following steps:
[0023] S1. Obtain the input text data.
[0024] S2. Perform sentence segmentation on the input text, dividing the text into sentence-level units.
[0025] Sentence-level unit: refers to an independent and complete sentence obtained after identifying and segmenting sentence boundaries in a coherent input text; this unit is the basic processing object for subsequent structural perturbation and reconstruction operations.
[0026] S3. Based on the multi-dimensional structural index for evaluating the structural attributes of text, perturbation strategies and corresponding perturbation intensities are selected from the predefined strategy space to perturb the structure of sentence-level units, generating perturbed text with disrupted structure; the strategy space includes sentence order perturbation, intra-sentence structural transformation, voice conversion and word substitution.
[0027] Specifically, such as Figure 2 As shown, in the structural perturbation stage, controlled structural disruption is applied to the sentence-level unit through the following steps: First, the overall sentence order coherence of the text is evaluated through the L1 sentence order layer, and a sentence order perturbation strategy is selected. Then, the syntactic complexity of the text is evaluated through the L2 syntax layer, and an intra-sentence structural transformation strategy is selected. This process is repeated until all four layers of structural awareness and perturbation are completed, generating perturbed text that is perturbed at the sentence order or syntax level. As an example, in the structural perturbation stage, a perturber is used to apply controlled structural disruption to the sentence-level unit. The perturber employs a four-layer structure awareness design (L1-L4), applying structural intervention sequentially from the overall sentence order to the local syntax. Each layer is guided by corresponding structural indicators, selecting appropriate perturbation strategies and intensities to generate perturbed text that is perturbed at the sentence order or syntax level.
[0028] The structural perturbation module is a learnable, task-adaptive functional module. It analyzes the input sentence-level units and performs structural destruction operations.
[0029] Controllable structural disruption: This means that the structural perturbation module does not perform random perturbation, but rather, based on the evaluation of multidimensional structural indicators, it adaptively selects the most effective perturbation strategy and intensity through a differentiable strategy selection mechanism (such as Gumbel-Softmax), thereby generating perturbation text that is challenging and conducive to subsequent judgment. Multidimensional structural indicators include sentence order complexity, syntactic structure complexity, lexical diversity, and discourse logical coherence.
[0030] Perturbed text: refers to text that has been processed by the perturbation module of this structure, and has undergone changes relative to the original text in terms of sentence order, syntactic structure, or vocabulary usage.
[0031] S4. In the structural reconstruction stage, the perturbed text is reconstructed using a structural reconstruction module based on an encoder-decoder architecture, and feature vectors reflecting the dynamic changes in the text structure are extracted simultaneously. These feature vectors include the perturbed vector output by the encoder and the reconstructed vector output by the decoder.
[0032] The structural reconstruction module is another core component of this invention, typically implemented using an encoder-decoder architecture based on a pre-trained language model. Its core function is to attempt to restore perturbed text to its original structure and order.
[0033] Encoder-decoder architecture: a neural network structure; in this invention, the encoder is responsible for understanding and encoding the structural state of the perturbed text, while the decoder gradually generates the restored text in an autoregressive manner.
[0034] Perturbation structure vector: A feature vector output by the encoder that encodes the state information of the text after it has been structurally disrupted.
[0035] Reconstruction structure vector: A feature vector output by the decoder during the generation of reconstructed text, which encodes the behavioral pattern of the model attempting to restore the structure.
[0036] S5. By integrating multi-source features, it effectively distinguishes between human-written text and machine-generated text. Input features include three categories: original semantic vectors (extracted by the encoding model) and original text structure indicators, perturbation structure vectors (from the encoder) and perturbation text structure indicators, and reconstructed structure vectors (from the decoder) and reconstructed text structure indicators. Each feature is independently mapped by a multilayer perceptron (MLP) and then concatenated and fused into a fused feature.
[0037] Original semantic vector: refers to the feature vector representing the overall semantic content of the original input text extracted from it without any perturbation through an independent encoding model.
[0038] Original text structure metrics: These are numerical values that quantify the structural attributes of original input text, calculated using predefined rules or models, such as sentence length distribution, syntactic complexity, and coherence score.
[0039] Perturbed text structure index: refers to the structural quantification value calculated based on the perturbed text, which is of the same category as the original text structure index, and is used to compare the structural changes before and after the perturbation.
[0040] Reconstructed Text Structure Indicators: Based on the reconstructed text output by the structure reconstruction module, a set of values are calculated using the same quantification method as the original text to quantitatively describe the structural characteristics of the reconstructed text. These values are calculated in exactly the same way as the original text structure indicators and the perturbed text structure indicators, thus ensuring comparability among the three and reflecting the degree of structural recovery through comparison.
[0041] S6. In the classification stage, the fused feature is input into the classifier. The classification loss is backpropagated to both the perturbation module and the recombination module during training, thereby achieving end-to-end joint optimization. The joint optimization objective function is expressed as:
[0042] L total = L cls + αL rec + βL entropy ; in, L cls For classifying losses, L rec For restructuring losses, L entropy For perturbation entropy regularization, To control the weight of restructuring losses, To adjust the strength of the entropy regularization term.
[0043] End-to-end joint optimization refers to the collaborative training of the structural perturbation module, structural reconstruction module, and classifier as a whole during model training. The gradient of the classification loss can be backpropagated to these three modules simultaneously, thereby guiding the structural perturbation module to learn to generate more discriminative perturbations and guiding the structural reconstruction module to learn to extract recovery features that are more conducive to classification.
[0044] L cls It calculates the difference between the classifier's predictions and the true labels (human / machine) (such as cross-entropy loss), which directly optimizes the detection accuracy.
[0045] L rec The calculation module outputs the difference between the reconstructed text and the original text (such as cross-entropy loss), ensuring that the reconstructed text has basic language understanding and generation capabilities and preventing its behavior from going out of control.
[0046] L entropy : A regularization term applied to the differentiable policy selection mechanism of the structural perturbation module to encourage the diversity of policy selection and prevent it from converging prematurely to a few single perturbation policies, thereby ensuring that the generated training samples are rich and diverse.
[0047] α and β : These are two hyperparameters that serve as the weights for the recombination loss and the strength of the entropy regularization term, respectively. They are used to balance the relative importance of the three sub-objectives in the overall optimization objective, ensuring that the model maintains good language ability and policy exploration ability while pursuing high classification accuracy.
[0048] S7. Output the final text detection results.
[0049] Text detection result: refers to the final output of the classifier, which is a binary classification result used to clearly indicate whether the input text being analyzed was written by a human or generated by a machine.
[0050] Based on the above methods, the present invention proposes an embodiment, which specifically includes the following steps: S1. In the preprocessing stage, the input text is segmented into sentences, which makes it easier for the model to perform targeted modeling and operation on the inter-sentence structure in subsequent stages. On the other hand, it can also effectively reduce the computational pressure on the reorganization module when processing long texts, thereby improving efficiency and accuracy.
[0051] S2. The perturbation module takes the text after sentence segmentation as input, evaluates the structural properties of the text layer by layer under the guidance of multi-dimensional structural indicators, and adaptively selects the optimal perturbation strategy and its strength, thereby generating perturbed text with disrupted structure as subsequent input.
[0052] like Figure 2 As shown, the perturbator employs a four-layer structure-aware design, applying structural interventions sequentially from overall sentence order to local syntax. Each layer is guided by corresponding structural indicators, selecting appropriate perturbation strategies and intensities: the upper layer focuses on sentence order and overall complexity changes, the middle layer focuses on syntactic and lexical layer interventions, and the lower layer introduces discourse-level logical perturbations, thereby achieving multi-level structural modeling, specifically including:
[0053] Figure 2 The left side describes the hierarchical strategy selection process (determining the dimensions of the perturbation): 1. Input: Raw text, i.e., the initial text data to be processed.
[0054] 2. Step 1: Sentence segmentation: First, split the original text into independent sentences to form the basic unit segmentation for subsequent hierarchical analysis.
[0055] 3. Layered strategy (L1-L4, covering different dimensions of the text): L1: Macro Structure and Readability: Determine the macro direction of the disturbance from the perspective of the overall text framework (such as paragraph structure and logical thread) and the difficulty of reader comprehension.
[0056] L2: Syntactic integrity: Focuses on the grammatical structure of sentences (such as subject-verb-object, clause logic) to ensure that perturbations do not disrupt basic syntactic fluency (or adjust syntactic integrity as needed).
[0057] L3: Lexical complexity: Determine perturbation strategies at the lexical level based on the difficulty and specialization of words in the text (e.g., replacing them with simple / complex words).
[0058] L4: Text Coherence: Pay attention to the connecting words and logical relationships between sentences / paragraphs (such as connecting elements such as "therefore" and "however"), and adjust the coherence of the text.
[0059] 4. Output: Perturbed text (result after layered perturbation).
[0060] The disturbance execution process is as follows Figure 2 As shown: This part describes the specific perturbation operation logic. L1-L4 represent several layers of perturbation, each corresponding to a different level, ensuring that each policy layer can correspond to a perturbation: Input: The text cell to be disturbed.
[0061] Step 1: MLP1 → logit zl The text features are encoded using "MLP1" to output a vector logit z of the candidate policy set. l .
[0062] Step 2: Sampling is performed using Gumbel-Softmax (temperature τ controls the "dispersion" of the sampling; τ=1.0 represents moderate randomness), and the logit z is calculated. l This is transformed into a probability distribution of selectable perturbation strategies.
[0063] Step 3: Select (strategy, intensity): Based on the sampling results, determine the specific perturbation type (e.g., "adjust paragraph structure" or "replace words") and perturbation intensity (e.g., "minor adjustment" or "major modification") to be used in the current layer.
[0064] Step 4: Apply perturbation: Perform a perturbation operation on the text content of the current layer according to the selected "strategy + strength".
[0065] In summary, the original text is first split into basic units by "sentence segmentation", and then the dimensions of perturbation are defined by L1-L4 layers. At the same time, the perturbator achieves controllable selection of "policy + strength" through MLP+Gumbel-Softmax, and applies the corresponding perturbation in each layer from L1 to L4, finally generating "perturbed text" that meets the policy requirements.
[0066] This invention uses a four-layer structure perception unit to quantify the structural features of text, obtaining multi-dimensional structural indices that serve as the basis for subsequent perturbation strategy selection. The four-layer structure perception unit extracts structural features of the text from four dimensions: sentence order, syntax, vocabulary, and discourse, with each dimension corresponding to a quantified structural index.
[0067] To enhance the expressiveness and controllability of perturbations, this invention constructs a strategy space covering seven types of structural operations, including sentence order perturbation, intra-sentence structural transformation, voice conversion, and lexical substitution. All strategies are executed at the sentence level, and the perturbation amplitude is controlled by a discrete intensity parameter s. The perturbation intensity is initially set to nine candidate levels. After evaluation, the final selection was made. Three representative values correspond to weak, medium, and strong perturbation intensities, respectively. Each strategy corresponds to a four-layer structural sensing unit (L1–L4) to ensure structural consistency and controllability across different perturbation levels.
[0068] Specifically, disturbance intensity parameters The values correspond to three levels of perturbation intensity: weak, medium, and strong. These values are synergistically related to structural properties: for texts with strong structural properties (such as high sentence coherence and high syntactic complexity), a higher perturbation intensity (e.g., 0.8) is preferred to fully expose their structural vulnerabilities; for texts with weak structural properties, a lower perturbation intensity (e.g., 0.3) is chosen to avoid excessive disruption leading to information loss. This mechanism of adaptively adjusting perturbation intensity based on structural properties is key to achieving accurate structural modeling in this invention.
[0069] S3. After structural perturbation, a structural reconstruction module is introduced to restore the structure and sentence order of the perturbed text. This module is based on the encoder-decoder structure of a pre-trained language model, utilizing bidirectional encoding and autoregressive decoding capabilities to extract structural disruption and restoration features from a complementary perspective. For example... Figure 3 As shown, the module achieves stable structural recovery through a sentence-level reconstruction mechanism: the perturbed sentence serves as input, and the original sentence serves as the supervised target, enabling sentence reconstruction. The perturbation vector output by the encoder reflects structural destruction features, while the reconstruction vector output by the decoder represents the structural recovery behavior. The combination of these two approaches captures dynamic structural changes in the text and provides discriminative signals for classification. During training, the decoder simultaneously receives the joint gradient signal of the reconstruction loss and the classification loss. Reconstruction Loss Consistency between the generated text and the original text is achieved by constraining cross-entropy, and the classification loss is applied. Backpropagation from the final discriminator module enables the model to learn discriminative structural patterns.
[0070] Specifically, such as Figure 3 As shown, the recombiner process includes the following steps: 1. Total input reception: Receive the "perturbation text" (containing two types of content: perturbation sentences and original sentences) from upstream.
[0071] 2. Disturbance link (supply to T5 encoder).
[0072] Step 1: Split the perturbation text and extract the "perturbation sentence (S)". pert )".
[0073] Step 2: Prefix concatenate the perturbation sentence to generate a "reconstructed input" in the format "prefix + perturbation sentence".
[0074] Step 3: Pass the "reconstructed input" to the encoder module of the T5 model as the input source for the encoder.
[0075] 3. Original sentence link (supplying the T5 decoder): Step 1: Split the disturbed text and extract the "original sentence (S)". orig )".
[0076] Step 2: The original sentence is processed into the "decoder input" of the T5 decoder through the "teacher-forced mechanism".
[0077] Step 3: Pass the "decoder input" to the decoder module of the T5 model as the input source for the decoder.
[0078] 4. Interaction with the T5 encoder: The "reconstructed input (+disturbance sentence)" output by the reconstructor is directly used as the input text for the T5 encoder.
[0079] After receiving input, the T5 encoder outputs an encoder hidden representation (H). enc This signal will be simultaneously transmitted to two downstream links: The key-value pairs (K / V) inputs are passed to the T5 decoder as the key-value (K / V) inputs for the decoder's "cross-attention mechanism" in the cross-attention sublayer, to achieve information alignment between the encoder and decoder; or they are used to generate encoded sentence vectors (s) through "average pooling". enc ), which is used to generate V for subsequent attention pooling (attn-pool). pert .
[0080] 5. Interaction with the T5 decoder: Input connection: The "decoder input (original sentence + teacher coercion mechanism)" output by the reassembler is used to form the decoder input text of the T5 decoder through the teacher coercion method (i.e., using the target sentence as the decoder input).
[0081] After receiving the input, the T5 decoder combines it with the H signal transmitted from the encoder. enc Complete the cross-attention calculation and output two types of results: The decoded sentence vector (S) is generated through "average pooling". dec ), which is used to generate V for subsequent attention pooling (attn-pool). rec ; The output decoded features are passed to the "LM Head+CE" module to generate the predicted text (i.e. the basis for the reconstructed sentence).
[0082] 6. Follow-up connections in the interaction The output of the T5 module (encoded / decoded sentence vectors, generated text) will further connect to the downstream processes of the reassembler: S enc / S dec →Attention pooling generates V pert / V rec ; The generated text is processed by spaCy into "reconstructed text," and training supervision is completed using cross-entropy loss.
[0083] S4, the classifier part serves as the final discrimination unit of the overall framework, such as Figure 4 As shown, this module effectively distinguishes between human-written text and machine-generated text by integrating multi-source features. The input features include three categories: original semantic vectors (extracted by the encoding model) and original text structure indicators, perturbation structure vectors (from the encoder) and perturbation text structure indicators, and reconstructed structure vectors (from the decoder) and reconstructed text structure indicators. Each feature is independently mapped by a multilayer perceptron (MLP) and then concatenated and fused. Finally, a fused MLP is used for binary classification. This mechanism can capture the complementary relationships between semantic, perturbation, and structural recovery features, achieving global feature integration.
[0084] Specifically, such as Figure 4 As shown, this is a multi-path fusion MLP classifier used to integrate multi-source features and output classification / prediction results. Its structure and function can be broken down into the following parts: 1. Path-specific MLPs (3 in total, with the same structure).
[0085] Input correspondence: Receive three types of features respectively: "original vector + indicator", "perturbation vector + indicator", and "reconstruction vector + indicator".
[0086] Internal structure: Each path MLP contains 3 modules: Linear layer: Performs dimensional transformation and preliminary encoding on the input features.
[0087] ReLU activation function: Introduces nonlinearity to enhance feature representation ability.
[0088] Dropout layer: Randomly discards some neurons to suppress model overfitting.
[0089] Path-specific MLPs extract features independently for each type of input feature while preserving the unique information of each path.
[0090] 2. Feature concatenation operation: The feature vectors output by the three path-specific MLPs are concatenated to integrate the information of multi-source features and provide complete feature input for subsequent fusion.
[0091] 3. Fusion MLP: Input: The concatenated multi-source feature vector.
[0092] Internal structure: Linear3: Transforms the concatenated features (with dimensions hidden_dim*3) into the fusion_dim dimension.
[0093] ReLU activation function: further introduces nonlinearity.
[0094] Dropout layer: further suppresses overfitting.
[0095] Linear (output layer): Compresses the features of the fusion_dim dimension into 1 dimension and outputs the final classification / prediction result.
[0096] The MLP is used to deeply fuse multi-source features, extract cross-path association information, and output task results.
[0097] S5. Joint optimization process: This invention introduces a differentiable policy selection mechanism based on Gumbel–Softmax. This mechanism allows the perturber to receive gradient signals during training, thereby dynamically adjusting its policy behavior. For each structure-aware layer, structural indices are encoded as vectors. The lightweight network outputs the logits vector of the candidate policy set. During the differentiable sampling phase, the policy distribution is defined as:
[0098] ; in, For noise from the Gumbel distribution, Let be the temperature parameter. This continuous relaxation method maintains differentiability during backpropagation, thus achieving end-to-end optimization. To prevent the perturber from prematurely converging to a single policy, an entropy regularization term is introduced to maintain the diversity of policy distributions:
[0099] ; in, L entropy For perturbation entropy regularization, N For the sample size, i From 1 to N Iterate through each sample in the batch. For example, in a machine-generated text detection task, each sample might be a text fragment or a sentence-level unit. j The strategy index represents the traversal of all possible perturbation strategies (such as sentence order perturbation, intra-sentence structure transformation, etc.). p ij Choose probabilities for the strategy. p ij Is for the first i The nth sample, select the nth j The mechanism transforms the perturbation from a static heuristic process into a task-driven, learnable dynamic process, thereby generating more representative samples of structural changes.
[0100] The classification loss is backpropagated to both the perturbation and reconstruction modules during training, thereby achieving end-to-end joint optimization and improving detection performance. The joint optimization objective of this invention consists of three parts: classification loss... Restructuring losses With perturbation entropy regularization term The overall objective is expressed as:
[0101] ; in, L cls For classifying losses, L rec For restructuring losses, L entropy For perturbation entropy regularization, Controlling the weighting of restructuring losses, Adjusting the strength of the entropy regularization term. Through this joint optimization mechanism, the model can achieve a balance between classification accuracy and structural modeling ability, thereby effectively improving the detection performance and robustness against highly disguised text.
[0102] This invention improves the ability to recognize text structural changes by introducing structural perturbation and restructuring mechanisms. Compared with existing schemes that rely on semantic features, it can still accurately output discrimination results when faced with external transformations such as paraphrasing, polishing, or sentence structure adjustments, reducing false positives and false negatives caused by structural camouflage. Under conditions of multiple text sources, the system maintains high detection consistency and has good adaptability.
[0103] Experimental verification: To verify the effectiveness of this invention, comparative experiments were conducted with typical detection methods such as ChatGPT-detector-RoBERTa, Binoculars, DetectGPT, and Fast-DetectGPT. The evaluation metrics used were AUROC and F1, which comprehensively reflect detection performance and classification stability. The experiments covered three task scenarios: basic detection (IEEE-Generation, IEEE-Polish), multi-domain evaluation (ArXiv, Writing, XSum, Review), and multi-model detection (ChatGPT-3.5, Claude, PaLM-2, LLaMA-2). The results are shown in Tables 1–3.
[0104] Table 1. Comparison of detection performance of the present invention and existing methods on different datasets. Table 2. Comparison of detection performance between the present invention and the comparative method under multiple generative model conditions. Table 3. Comparison of detection performance of the present invention and the comparison method in multiple text domains. This invention is applicable to machine-generated text recognition tasks from different sources and of different types. In basic detection scenarios (such as IEEE-Generation), this invention can reliably distinguish between human-generated text and machine-generated text. In multi-text domain detection (ArXiv, Writing, XSum, Review), this invention maintains stable performance under the detection requirements of multiple domains. It also demonstrates good adaptability and consistency when dealing with text generated by different models (ChatGPT-3.5, Claude, PaLM-2, LLaMA-2).
[0105] In the spoofed text detection task (IEEE-Polish), the scores of DetectGPT and Fast-DetectGPT dropped significantly compared to the basic scenario, and Binoculars also declined to some extent. In contrast, this invention still maintains a high AUROC and F1 score, which fully demonstrates that it is more sensitive to structural perturbations, has stronger anti-spoofing detection capabilities, and can effectively identify machine-generated text that has been polished or reconstructed.
[0106] This invention introduces a structural change feature modeling mechanism, which can maintain good recognition consistency when processing text that has undergone structural reconstruction such as polishing and rewriting, and has the ability to adapt to structural deformation scenarios.
[0107] Based on the same inventive concept, the present invention also provides a machine-generated text detection system, comprising: The text acquisition module is used to acquire input text data and divide the input text data into multiple sentence-level units.
[0108] The structural perturbation module is used to select perturbation strategies and corresponding perturbation intensities from a predefined strategy space based on multidimensional structural indicators that evaluate the structural attributes of text, and to perturb sentence-level units to generate perturbed text with disrupted structure.
[0109] The structure reconstruction module is used to input perturbed text into an encoder-decoder structure based on a pre-trained language model. With the original text data as the supervision target, the encoder extracts perturbation vectors that represent structural destruction features from the perturbed text, and the decoder performs autoregressive structure recovery on the perturbation vectors to generate reconstructed text and extract reconstructed vectors that represent structural recovery behavior features from the reconstructed text.
[0110] The discrimination module is used to concatenate and fuse the original semantic features extracted from the input text data with the perturbation vector and the recombined vector; and to perform binary classification based on the fused feature vector to output the detection result of whether the input text data is machine-generated.
[0111] The present invention also provides a computer-readable storage medium storing a computer program that can be used to execute the above-described... Figure 1 The steps of the provided machine-generated text detection method.
[0112] This invention also provides a computer device. At the hardware level, the computer device includes a processor, an internal bus, a network interface, memory, and non-volatile memory, and may also include other hardware required for various operations. The processor reads the corresponding computer program from the non-volatile memory into memory and then executes it to achieve the above-mentioned functions. Figure 1 The steps of the provided machine-generated text detection method.
[0113] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0114] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, as well as combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0115] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0116] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0117] It should be noted that the specific embodiments described above enable those skilled in the art to more fully understand the present invention, but do not limit the present invention in any way. Therefore, although the present invention has been described in detail in this specification, those skilled in the art should understand that modifications or equivalent substitutions can still be made to the present invention; and all technical solutions and improvements that do not depart from the spirit and scope of the present invention are covered within the protection scope of the patent of the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.
Claims
1. A method for detecting machine-generated text, characterized in that, Includes the following steps: Acquire the input text data and divide the input text data into multiple sentence-level units; Based on a multidimensional structural index for evaluating text structural attributes, a perturbation strategy and its corresponding perturbation intensity are selected from a predefined strategy space to perturb the structure of sentence-level units, generating perturbed text with disrupted structure. The perturbation text is input into an encoder-decoder structure based on a pre-trained language model. The original text data is used as the supervision target. The encoder extracts the perturbation vectors that represent structural destruction features in the perturbation text. The decoder performs autoregressive structural recovery on the perturbation vectors to generate reconstructed text and extracts the reconstructed vectors that represent structural recovery behavior features in the reconstructed text. The original semantic features extracted from the input text data are concatenated and fused with the perturbation vector and the recombined vector; a binary classification is performed based on the fused feature vector to output the detection result of whether the input text data is machine-generated.
2. The method according to claim 1, characterized in that, The process of selecting perturbation strategies and corresponding perturbation intensities from a predefined strategy space to perform structural perturbation on sentence-level units based on the multidimensional structural index that evaluates text structural attributes also includes applying structural intervention to sentence-level units from different levels using four layers of structural perception units. The first layer of structural perception unit focuses on sentence order and overall complexity changes; the second layer focuses on syntactic structure intervention; the third layer focuses on lexical layer intervention; and the fourth layer focuses on discourse-level logical perturbation. Each layer of structural perception unit is guided by a corresponding structural index to select a perturbation strategy from the strategy space and determine the perturbation intensity.
3. The method according to claim 2, characterized in that, The sentence-level units are structurally perturbed by selecting perturbation policies and corresponding perturbation intensities from a predefined policy space using a differentiable policy selection mechanism based on Gumbel-Softmax. In this mechanism, for each structure-aware layer, structural indices are encoded as vectors, and then a lightweight network outputs the logits vector of the candidate policy set. Continuous relaxation of the policy distribution is achieved through Gumbel-Softmax sampling, and policy diversity is maintained through an entropy regularization term; wherein, the policy distribution Represented as: ; in, For noise from the Gumbel distribution, For temperature parameters; The entropy regularization term Represented as: ; in, N For batch size, i This is the index of the samples in the batch. j For strategy indexing, For the first i The first sample selection j The probability of a perturbation strategy.
4. The method according to claim 1, characterized in that, The strategy space includes sentence order perturbation, intra-sentence structure transformation, voice conversion, and vocabulary substitution.
5. The method according to claim 1, characterized in that, The multidimensional structural indicators include sentence order complexity, syntactic structure complexity, lexical diversity, and discourse logical coherence.
6. The method according to claim 3, characterized in that, It also includes end-to-end joint training of the structural perturbation process, the structural recovery and reconstruction process, and the binary classification process through a joint optimization objective function; the joint optimization objective function is expressed as: ; in, This represents the joint optimization objective function. L cls For classifying losses, L rec For restructuring losses, L entropy For entropy regularization, To control the weight of restructuring losses, To adjust the strength of the entropy regularization term.
7. A machine-generated text detection system, characterized in that, include: The text acquisition module is used to acquire input text data and divide the input text data into multiple sentence-level units. The structural perturbation module is used to select perturbation strategies and corresponding perturbation intensities from a predefined strategy space based on multidimensional structural indicators that evaluate the structural attributes of text, and to perturb sentence-level units to generate perturbed text with disrupted structure. The structure reconstruction module is used to input perturbed text into an encoder-decoder structure based on a pre-trained language model. With the original text data as the supervision target, the encoder extracts perturbation vectors that represent structural destruction features from the perturbed text, and the decoder performs autoregressive structure recovery on the perturbation vectors to generate reconstructed text and extract reconstructed vectors that represent structural recovery behavior features from the reconstructed text. The discrimination module is used to concatenate and fuse the original semantic features extracted from the input text data with the perturbation vector and the recombined vector; and to perform binary classification based on the fused feature vector to output the detection result of whether the input text data is machine-generated.
8. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, which, when executed by a processor, implements the method described in any one of claims 1 to 6.
9. A computer device, characterized in that, The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method described in any one of claims 1 to 6.