Machine-Generated Text Detection Method Based on Frequency Domain Feature Extraction and Local Frequency Filtering

By employing frequency domain feature extraction and local frequency filtering, the stability issues of machine-generated text detection in cross-domain and cross-model scenarios are resolved, achieving higher detection accuracy and robustness, and making it suitable for content security review and text credibility assessment.

CN122285899APending Publication Date: 2026-06-26XI AN JIAOTONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610389015.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-27
Publication Date
2026-06-26

AI Technical Summary

Technical Problem

Existing machine-generated text detection methods lack stability in cross-domain, cross-generator, and cross-model scenarios, are easily affected by distribution drift, and are sensitive to text surface features or global semantic biases, which limits the generalization ability of the model.

Method used

We employ a method based on frequency domain feature extraction and local frequency filtering. We construct an initial frequency domain representation through Fast Fourier Transform, identify significant frequency points and divide frequency bands, construct a local frequency representation, and combine global frequency domain patterns and spectrum reconstruction to perform end-to-end optimization, thereby improving detection robustness and generalization performance.

Benefits of technology

It can effectively identify the potential structural patterns of machine-generated text, improve detection accuracy and robustness, and maintain stable discrimination performance across domains, generators and post-editing scenarios, thus having high engineering application value.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122285899A_ABST
    Figure CN122285899A_ABST
Patent Text Reader

Abstract

This invention discloses a machine-generated text detection method based on frequency domain feature extraction and local frequency filtering. The method involves embedding the input text and constructing an initial frequency domain representation, then building a local frequency filtering module. This module extracts local salient features of the text in different frequency bands through peak detection and frequency band mask generation, forming a multi-band local frequency representation, and constructing a global frequency domain representation that spans both text and models. Text features are fused in both the time and frequency domains, and a unified discriminant representation for machine-generated text detection is constructed through spectrum reconstruction. The local frequency filtering module, spectrum reconstruction, and discriminant network are jointly optimized end-to-end to output prediction results. This invention can effectively identify the potential structural patterns of machine-generated text in the frequency domain dimension, exhibiting high detection accuracy, strong cross-model robustness, and excellent out-of-domain generalization performance. It can be widely applied in scenarios such as content security review, text credibility assessment, and source tracing analysis of content generated by large models.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of natural language processing and content security detection technology, and specifically relates to a machine-generated text detection method based on frequency domain feature extraction and local frequency filtering, which can be used to determine the authenticity and identify risks of text generated by large-scale pre-trained language models. Background Technology

[0002] With the rapid development of large-scale pre-trained language models, machine-generated text is widely used in scenarios such as news writing, social media content production, intelligent question answering, educational assistance, and office writing. While machine-generated text can significantly improve content production efficiency, it also brings risks such as the spread of misinformation, academic misconduct, public opinion manipulation, spam content generation, and identity spoofing. Therefore, how to accurately, robustly, and generalizeably detect whether input text is machine-generated has become an important research direction in the fields of content security and text forensics.

[0003] Existing machine-generated text detection methods mainly include those based on statistical features, those based on language model perplexity or likelihood features, and those based on deep classifiers. Among these, perplexity or likelihood-based methods typically rely on distribution assumptions specific to a language model, making them prone to performance degradation in cross-generator or cross-domain scenarios. While deep classifier-based methods generally perform well under identical distribution test conditions, they are susceptible to distribution drift when facing machine-generated text detection tasks involving different generators, models of varying sizes, and text from different domains, leading to decreased detection stability. Furthermore, some detection methods are sensitive to text surface features or global semantic biases, potentially introducing task-irrelevant noise features during cross-domain transfer, limiting the model's generalization ability. Summary of the Invention

[0004] To overcome the shortcomings of existing technologies, this invention aims to provide a machine-generated text detection method based on frequency domain feature extraction and local frequency filtering. This method can extract more structurally discriminative feature representations from text representations and maintain the stability of machine-generated text detection across domains, generators, and post-editing scenarios. Frequency domain analysis can characterize the differences in text generation processes from the perspective of energy distribution and structural changes in sequence representations. By selectively retaining and recalibrating information in different frequency bands, it is expected to weaken the influence of low-frequency components that are domain-related but irrelevant to discrimination, and highlight mid-to-high frequency fine-grained features related to differences in generation mechanisms, thereby improving the robustness and generalization performance of machine-generated text detection.

[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows: A machine-generated text detection method based on frequency domain feature extraction and local frequency filtering includes the following steps: Step 1: Perform embedding transformation on the input text and construct an initial frequency domain representation for subsequent detection of significant frequency components and frequency band division.

[0006] Step 2: Construct a local frequency filtering module. Based on the spectral features in the initial frequency domain representation, extract local salient features of the text in different frequency bands through peak detection and frequency band mask generation, and form a multi-band local frequency representation.

[0007] Step 3: Perform statistical analysis on the overall spectral data of the text in the initial frequency domain representation, establish a global frequency domain pattern, and combine it with the multi-band local frequency representation to construct a global frequency domain representation across text and models, so as to improve the overall structural recognition capability of machine-generated text.

[0008] Step 4: Jointly model the text features in the time domain and frequency domain representation spaces. Obtain a unified frequency domain representation by weighted reconstruction of mid-frequency and high-frequency components, and map it back to the original feature domain through inverse discrete Fourier transform, thereby constructing a unified discriminant representation for machine-generated text detection.

[0009] Step 5: During the joint learning process, the local frequency filtering module, spectrum reconstruction and discrimination network are jointly optimized end-to-end. Robust detection is achieved by synergistically minimizing the classification loss and frequency domain alignment loss, and the text authenticity prediction result is output.

[0010] In one embodiment, step 1, which involves constructing an initial frequency domain representation by performing an embedding transformation on the input text and then executing a Fast Fourier Transform, can be specifically implemented as follows: Step 1.1: Segment or encode the input text to obtain a token sequence representation, and map the word vectors or hidden states of the pre-trained language model to a continuous embedding space to obtain a text embedding sequence. ; Step 1.2, for the text embedding sequence Perform a Fast Fourier Transform (FFT or rFFT) to obtain the amplitude spectrum. Phase spectrum The amplitude spectrum Phase spectrum is used to reflect the energy distribution across different frequency bands. Used to describe changes in sequence structure; Step 1.3, the amplitude spectrum The average amplitude curve is obtained by averaging the positions, and it serves as the basic template for subsequent local frequency significance detection.

[0011] In one embodiment, in step 1.1, the pre-trained language model is a decoder-based or encoder-based language model, and the text embedding sequence is represented as... It can be composed of word vector output or intermediate hidden state output. It is the first n One word, The number of tokens is denoted by 'token', and the word dimension is the latent space dimension of the pre-trained language model.

[0012] In one embodiment, step 1.2, using Fast Fourier Transform (FFT) or rFFT, performs a one-dimensional transformation along the token dimension on the text embedding sequence to obtain a frequency domain representation, thereby obtaining the amplitude spectrum. Phase spectrum The amplitude spectrum It can be obtained by taking the modulus of the frequency domain coefficients; In one embodiment, step 1.3, the average amplitude curve is obtained by analyzing the amplitude spectrum. The average amplitude curve is obtained by averaging over a preset dimension and serves as a reference template for subsequent local frequency saliency detection, used to stabilize the amplitude scale differences between different text lengths and different samples.

[0013] Therefore, in terms of text representation, this invention maps the input text to the embedding space and then uses Fast Fourier Transform to perform frequency domain transformation on the sequence representation to obtain its amplitude spectrum and phase spectrum as frequency domain features, thereby being able to characterize the energy distribution and change patterns of machine-generated text in different frequency bands.

[0014] In one embodiment, step 2 can be specifically implemented as follows: Step 2.1: Obtain the amplitude spectrum based on the spectral characteristics. The average amplitude curve is obtained by averaging according to position. Based on the average amplitude curve, the high significant frequency points of the text are identified by the local peak detection algorithm, and divided into three categories: high frequency, medium frequency and low frequency according to their relative intensity. Step 2.2: Construct a corresponding frequency domain mask for each frequency band, including a high-frequency mask, a mid-frequency mask, and a low-frequency mask, which are used to extract the energy concentration patterns of the text in different frequency bands. Step 2.3: Calculate the local peak features and non-peak mean features for each frequency band to obtain the frequency domain feature vector after local frequency filtering, i.e., the high-frequency feature vector. Mid-frequency eigenvectors With low-frequency feature vectors .

[0015] Step 2.4: Concatenate or weightedly fuse the above frequency domain feature vectors to obtain a complete multi-band local frequency representation. .

[0016] In one embodiment, step 2.1, the local peak detection algorithm includes: comparing each frequency position with its neighborhood amplitude value on the average amplitude curve, determining the frequency position that satisfies the local maximum and is significantly higher than the neighborhood mean or threshold as a significant frequency point, and classifying it into three categories: high frequency, mid frequency and low frequency based on the relative amplitude intensity or frequency range of the significant frequency point. In one embodiment, step 2.2, the frequency domain mask is a binary or continuous weight vector with the same dimension as the frequency domain coefficients, including a high-frequency mask, a mid-frequency mask, and a low-frequency mask; wherein, the frequency positions belonging to the corresponding frequency band are assigned a value of 1 or a weight greater than 0, and the frequency positions not belonging to the corresponding frequency band are assigned a value of 0, thereby achieving selective preservation of frequency domain components of different frequency bands.

[0017] In one embodiment, step 2.3, calculating local peak features and non-peak mean features for each frequency band, includes: aggregating the amplitude values ​​of frequency positions identified as peaks within the frequency band to obtain peak statistics, and aggregating the amplitude values ​​of non-peak positions within the frequency band to obtain non-peak mean statistics, thereby forming a frequency domain feature vector after local frequency filtering for the corresponding frequency band. .

[0018] In one embodiment, step 2.4, local frequency representation The construction method is as follows: , , The three data points can be fused by splicing or by setting weighting coefficients and performing a weighted summation to obtain a complete local frequency representation. .

[0019] In one embodiment, step 3 can be specifically implemented as follows: Step 3.1: Based on the total amplitude spectrum data, establish global frequency distribution statistics, including global average energy, energy density change rate, energy center migration characteristics, etc. Step 3.2: Construct a global frequency domain representation by combining the multi-band local frequency representation with the global frequency distribution statistics through a feature fusion network (such as a linear layer, multilayer perceptron, or lightweight Transformer). , used to characterize the structural consistency of text across the entire frequency band; Step 3.3: Based on the changing trend of frequency energy in different frequency bands and the coupling characteristics between frequency bands, construct a frequency domain discrimination mode to distinguish between machine-generated text and human text.

[0020] In one embodiment, step 3.1, the global frequency distribution statistics include at least: global average energy, energy density change rate, and energy center migration characteristics; wherein the global average energy is used to describe the overall spectral energy level, the energy density change rate is used to describe the trend of spectral energy change with frequency, and the energy center migration characteristics are used to describe the degree of shift of the energy center of gravity between frequency bands.

[0021] In one embodiment, in step 3.2, the feature fusion network is any one or a combination of a linear layer, a multilayer perceptron, or a lightweight Transformer, to characterize the structural consistency of the text across the entire frequency band.

[0022] In one embodiment, step 4 can be specifically implemented as follows: Step 4.1: Encode the input text using a pre-trained language model to obtain a feature space representation (such as document-level / token-level hidden states), and then divide it into three frequency domain feature vectors according to frequency bands in the frequency domain space, namely: high-frequency feature vectors. Mid-frequency eigenvectors With low-frequency feature vectors Low-frequency data tends to reflect global / topic information, while mid-to-high-frequency data tends to reflect fine-grained differences at the sentence and word levels.

[0023] Step 4.2, based on the idea of ​​local frequency filtering, suppress domain-sensitive but task-independent low-frequency components, and address the low-frequency components. Filtering or zeroing is performed to retain only the mid-to-high frequencies, which are then concatenated to form the filtered frequency domain representation. As the core frequency domain feature input for subsequent reconstruction and discrimination, Indicates a splicing operation; Step 4.3, based on the input of a batch containing... The nth sample, for the nth Spectrum reconstruction is performed on each sample to obtain the reconstructed frequency domain features in the frequency space. ,,in , It is the first The mid-frequency feature vector and high-frequency feature vector of each sample.

[0024] Step 4.4 involves mapping the reconstructed frequency domain features back from the frequency domain space to the time domain space via an inverse frequency domain transformation to obtain the transformed natural text feature representation. This refers to the unified discriminant representation. This process is equivalent to completing "low-frequency redundancy removal + mid-to-high frequency recalibration" in the frequency domain, and then returning to the feature space to form a unified discriminant representation that can be directly used for classification, thereby reducing the global offset caused by cross-domain migration while preserving fine-grained differences.

[0025] In one embodiment, step 4.1 involves treating the feature space representation as a one-dimensional discrete signal, then performing a 1D DFT or rFFT on it to obtain a set of frequency domain coefficients, which are then divided into three frequency domain feature vectors according to frequency bands, i.e., high-frequency feature vectors. Mid-frequency eigenvectors With low-frequency feature vectors .

[0026] In step 4.3, during the spectrum reconstruction stage, the average amplitude statistics are calculated for the mid-frequency feature vector and the high-frequency feature vector within a batch. and compared with the average amplitude of the corresponding frequency band of the entire training set. , Alignment yields weighting coefficients for frequency band recalibration. Based on this, the mid-to-high frequency components are weighted and reconstructed to obtain the final frequency domain features. .

[0027] In one embodiment, step 5 involves performing end-to-end joint optimization using classification loss and frequency domain alignment loss, and then applying this optimization to the inference output. The specific implementation method can be described as follows: Step 5.1: Using the unified discriminant representation as the classification input, a lightweight discriminant head (such as a linear layer / multilayer perceptron) outputs a machine-generated or human-written prediction, and the cross-entropy classification loss is calculated based on the real labels. This classification of loss is explicitly defined in the uniform discriminant representation (i.e., by...). Supervised learning is then performed on the representation in the feature space.

[0028] Step 5.2, to further improve cross-domain generalization ability, introduce feature alignment constraints in the frequency domain space: In the frequency domain space, for samples with the same label within the same batch, their frequency domain features... Minimize the average between samples Distance, resulting in frequency domain alignment loss This is to reduce the differences in spectral distribution of similar samples under different domain / different generator conditions.

[0029] Step 5.3: Sum the classification loss and the frequency domain alignment loss to obtain the overall optimization objective. Furthermore, a stochastic gradient descent optimizer is used to jointly update the encoder, local frequency filtering module, learnable part in the spectrum reconstruction process, and discriminator, thereby achieving collaborative learning of frequency domain information and feature space information. Step 5.4: In the inference phase, reuse the same "feature space encoding → frequency domain decomposition → low-frequency suppression → spectrum reconstruction" process from training. Returning to the "Feature Space → Classification Head Prediction" process, the output is the prediction result of the machine-generated text or its corresponding confidence score.

[0030] Therefore, in terms of feature enhancement, this invention constructs a local frequency filtering module. Based on the average spectral characteristics of the text at different locations, it automatically identifies significant frequency components, constructs high-frequency, low-frequency, and mid-frequency masks respectively, and generates corresponding frequency component representations through local peak detection and non-peak mean calculation, achieving differentiated capture of the potential generation patterns of the text. In terms of model learning, it jointly models frequency domain features with original time domain features, fusing them through a multilayer perceptron or lightweight discriminant network to form a text detection representation that simultaneously contains local structural information and global frequency domain patterns, thereby enhancing the generalization ability for cross-domain and cross-model generated text. During the detection process, by comparing the frequency domain energy distribution, local frequency band change trends, and feature correlations of different frequency bands, it outputs a prediction result indicating whether the text is machine-generated or human-written.

[0031] Compared with the prior art, the beneficial effects of the present invention are: (1) This invention treats the pre-trained language model embedding / hidden state of the input text as a sequence signal and introduces methods such as fast Fourier transform to construct a frequency domain representation. It describes the difference between machine-generated text and human text from the perspective of spectral energy distribution and structural changes, breaking through the limitation of relying only on surface vocabulary or global likelihood features, and making the detection features more structurally discernible and stable.

[0032] (2) The present invention designs a local frequency filtering module, which automatically identifies significant frequency components based on the average amplitude spectrum and local peak detection, constructs high-frequency / mid-frequency / low-frequency masks and extracts corresponding frequency band features. By suppressing low-frequency components that are related to domain offset but have low discrimination contribution and highlighting fine-grained differences in mid- and high-frequency characteristics, the distribution drift caused by cross-domain, cross-topic and cross-writing style can be effectively reduced, thereby improving detection robustness and generalization performance.

[0033] (3) This invention further combines local frequency representation with global frequency domain statistics to establish a global frequency domain representation, and introduces spectrum reconstruction and frequency domain alignment constraints during the training process. Through joint optimization of cross-entropy classification loss and frequency domain alignment loss, the samples of the same type are more compact in the frequency domain space and the samples of different types are more separable. Thus, it can maintain a high detection accuracy, low error and more stable discrimination performance in cross-generator, cross-model scale and post-editing scenarios such as polishing, continuation and rewriting. It has high engineering application and content security practice value.

[0034] In summary, this invention can effectively identify the potential structural patterns of machine-generated text in the frequency domain. Compared with traditional detection methods that rely solely on time domain features, it has the advantages of high detection accuracy, strong cross-model robustness, and excellent out-of-domain generalization performance. It can be widely applied to scenarios such as content security review, text credibility assessment, and source tracing analysis of large model-generated content. Attached Figure Description

[0035] Figure 1 This is a diagram of the machine-generated text detection architecture based on frequency domain feature extraction and local frequency filtering of the present invention.

[0036] Figure 2 This is a structural diagram showing the distribution of the text of this invention in the feature domain and its corresponding frequency domain space.

[0037] Figure 3 This is a schematic diagram illustrating the effect of perturbations on frequency modules and the alignment results in the feature space and frequency domain space of this invention.

[0038] Figure 4 This is a schematic diagram illustrating the impact of hyperparameters on the machine-generated text detection short text capability based on frequency domain feature modeling and local frequency filtering mechanism of this invention. Detailed Implementation The embodiments of the present invention will now be described in detail with reference to the accompanying drawings and examples.

[0039] like Figure 1 As shown, the present invention provides a machine-generated text detection method based on frequency domain feature extraction and local frequency filtering, comprising the following steps: Step 1: Perform embedding transformation on the input text and execute Fast Fourier Transform to construct an initial frequency domain representation for subsequent detection of significant frequency components and frequency band division.

[0040] Step 1.1: Data and Sample Composition. This embodiment uses publicly available machine-generated text detection datasets for training and evaluation, including three datasets: M4, DetectRL, and MAGE. Detection performance is verified under three domain generalization settings: 1) Cross-Domain: Composed of DetectRL and MAGE, it includes different text domains such as Opinion Statement (Opinion.S), Question Answering (Question.A), Story Generation (Story.G), and Scientific Writing (Scientific.W); 2) Cross-Generator: Composed of M4 and MAGE, the machine-generated text comes from generators such as Flan-T5, ChatGPT, GLM, and LLaMA; 3) Cross-Scale: Based on MAGE, the machine-generated text comes from generators of different scales such as LLaMA2-13B, LLaMA2-30B, and LLaMA2-65B.

[0041] Step 1.2: Sample Sampling and Training Data Organization. To facilitate experimental reproduction and stable training, this embodiment randomly selects 1000 samples from the original training set as a training subset, ensuring balance across different datasets, domains, and categories; the sample labels are binary labels of "machine-generated / human-written".

[0042] Step 1.3: Text Embedding and Frequency Domain Transformation. The input text is segmented or encoded to obtain a token sequence representation. This is then mapped to a continuous embedding space using word vectors or hidden states from a pre-trained language model, denoted as... For ease of explanation, take each One dimension (or pair) The scalar values ​​after dimensional aggregation form a one-dimensional discrete signal sequence: X=[0.20,0.10,0.00, 0.10, 0.20, [0.10, 0.00, 0.10]. Perform rFFT on this sequence to obtain the frequency domain coefficients and decompose them to obtain the amplitude spectrum. The phase spectrum Φ. For example, the amplitude spectrum can be represented as: A=[0.00,0.80,0.10,0.60,0.05]. Each position corresponds to a frequency bin (in the case of rFFT, the number of frequency bins is n / 2+1n / 2+1n / 2+1).

[0043] Step 2: Construct a local frequency filtering module based on the initial spectral features, and extract local salient features of the text in different frequency bands through peak detection and frequency band mask generation to form a multi-band local frequency representation.

[0044] Step 2.1: Significant Frequency Point Identification and Frequency Band Division. Based on the average amplitude curve obtained in Step 1, perform local peak detection on the frequency axis to identify significant frequency points and divide the frequency bands into low-frequency, mid-frequency, and high-frequency categories according to frequency range or relative amplitude intensity. For example, in performing local peak detection on the average amplitude curve A: an amplitude of 0.80 at frequency bin=1 is a significant peak, and an amplitude of 0.60 at bin=3 is also a significant peak. In this example, bin=0–1 is classified as low-frequency, bin=2–3 as mid-frequency, and bin=4 as high-frequency (this is just an example division method).

[0045] Step 2.2: Frequency Domain Mask Generation. Construct corresponding frequency domain masks (which can be binary or continuously weighted) for low-frequency, mid-frequency, and high-frequency components respectively to selectively retain or suppress components in different frequency bands. Calculate the aggregate statistics at peak positions and the mean statistics at non-peak positions within each frequency band to obtain the frequency domain feature vector after local frequency filtering. Using an example, a low-frequency mask: , , . Step 2.4: Local Frequency Representation Fusion. The features of each frequency band are concatenated or weighted and fused to form a local frequency representation, which is used for subsequent global modeling and discrimination. Using "peak statistics + non-peak mean statistics" as the local features of this frequency band, then... The three segments were reassembled to obtain .

[0046] Step 3: Perform statistical analysis on the overall spectral data of the text, establish a global frequency domain pattern, and combine it with local frequency representations to construct a global frequency domain representation across texts and models, so as to improve the overall structural recognition ability of machine-generated text.

[0047] Step 3.1: Construction of global statistics. Based on the amplitude spectrum data obtained in Step 1, global frequency distribution statistics are constructed, including global average energy, energy density change rate, energy center migration, etc., to characterize the overall spectral shape and frequency band energy distribution trend of the text.

[0048] Step 3.2: Global Representation Fusion. The representation obtained in Step 2... The global frequency domain representation is obtained by fusing the global statistics input features with a network (linear layer, multilayer perceptron, or lightweight Transformer) from step 3.1. It is used to characterize the structural consistency of text across the entire frequency band.

[0049] Step 3.3: Frequency Domain Discrimination Pattern Formation. Based on the energy variation trends and frequency band coupling characteristics of different frequency bands, a frequency domain discrimination pattern is formed to distinguish between machine-generated text and human text, providing input for the unified discrimination representation and training optimization in Steps 4–5.

[0050] Step 4: Fuse text features in both the time and frequency domains, and perform end-to-end joint optimization of the spectrum reconstruction and discrimination networks. By synergistically minimizing low-frequency suppression, spectrum reconstruction, inverse transform mapping, and classification loss and frequency domain alignment loss, machine-generated text detection and prediction results are achieved. Specifically, this includes the following steps: Step 4.1: Frequency Domain Decomposition and Low-Frequency Suppression. The feature space representation output by the pre-trained language model is treated as a one-dimensional discrete signal and subjected to frequency domain transformation, dividing it into low-frequency, mid-frequency, and high-frequency components. The low-frequency components are then filtered or zeroed out, retaining only the mid- and high-frequency components, which are then concatenated to form the filtered frequency domain representation. For example, in one example, the filtered frequency domain representation obtained after low-frequency suppression could be [0.60, 0.10, 0.05, 0.00]. Step 4.2: Spectrum Reconstruction and Inverse Transform Mapping. Calculate the average amplitude statistics for the mid-frequency and high-frequency components within a batch, and align them with the average amplitude of the corresponding frequency bands in the training set to obtain frequency band recalibration coefficients. Based on this, perform weighted reconstruction of the mid- and high-frequency components, and map the reconstructed frequency domain representation back to the feature space through an inverse transform to obtain a natural text feature representation, which is then used as a unified discriminant representation input to the classifier. For example, in one example, when batch=2, the average amplitude statistics for the mid-frequency and high-frequency batches are 0.55 and 0.045, respectively, while the corresponding mean values ​​in the training set are 0.50 and 0.050, resulting in exemplary recalibration coefficients of approximately 0.91 and 1.11; the reconstructed frequency domain representation can be [0.546, 0.091, 0.0555, 0.000], and the natural text feature representation obtained after the inverse transform can be [0.12, 0.06, ...]. 0.02, 0.08, 0.10, 0.05, 0.01, 0.06].

[0051] Step 4.3: Joint Training and Inference Output. **During the training phase, the natural text feature representation obtained in Step 4.2 is input into the discriminator to output the prediction result of "machine-generated / human-written" and the classification loss is calculated. Simultaneously, an alignment constraint is introduced in the frequency domain space. A frequency domain alignment loss is formed by minimizing the frequency domain differences of similar samples within the same batch. The classification loss and frequency domain alignment loss are jointly optimized to update the encoder, local frequency filtering module, spectrum reconstruction related parts, and discriminator.** During the inference phase, the same "encoding → frequency domain decomposition → low-frequency suppression → spectrum reconstruction → inverse transformation → classification prediction" process is reused from training to output the prediction result or confidence score. In one example, the discriminator outputs a "machine-generated" probability of 0.82; the frequency domain representations of two samples with the same label within the same batch can be [0.60, 0.10, 0.05, 0.00] and [0.58, 0.12, 0.06, 0.00], respectively, with a corresponding example value of 0.0125 for the frequency domain alignment loss. Finally Joint optimization was carried out.

[0052] like Figure 2 As shown, compared with the original representation in the text feature space, the frequency domain features exhibit a more consistent distribution pattern among similar samples in different domains, indicating that the frequency domain representation can more stably capture the structural differences between machine-generated text and human text, and provide a more reliable basis for discrimination under domain-offset conditions.

[0053] As shown in Table 3, different frequency bands exhibit differentiated responses to text perturbations at different levels: word-level perturbations cause more significant MAE shifts at higher frequency bands, while document-level perturbations such as topic transformations have a greater impact at lower frequency bands, and sentence rearrangement affects the middle frequency bands more. Furthermore, after mapping the features of different frequency bands back to the feature space through inverse transformation, a comparison of topic consistency with the original text reveals that low-frequency components are closest to the overall semantics of the original text, while high-frequency components have the lowest topic consistency. These results indicate that low-frequency features tend to retain global semantic information such as topic and style, and are therefore more susceptible to domain shifts. In contrast, mid- and high-frequency features are more sensitive to local structural changes and can more effectively characterize the fine-grained differences between machine-generated text and human text. Therefore, this invention, by suppressing low-frequency components and retaining mid- and high-frequency components, can effectively weaken the global shift caused by cross-domain migration, while highlighting discriminative information in local structural patterns, thereby improving the robustness and generalization ability of machine-generated text detection.

[0054] like Figure 4 As shown, the method of the present invention operates under different scaling factors. The method maintains a high and stable F1 score under all settings and outperforms existing comparison methods under different input lengths. Furthermore, the detection performance continues to improve as the input text length increases. This indicates that the method of the present invention not only has strong parameter robustness but also has good adaptability to short text scenarios.

[0055] The experimental results of this embodiment are as follows: Under cross-domain, cross-generator, and cross-scale settings, the proposed method achieved stable and consistent detection performance on the test sets. Specifically, the discriminative performance metrics, represented by accuracy and F1-score, remained at a high level. The overall detection performance across 11 test sets showed an average accuracy of 92.21% and an average F1-score of 91.96%. These experimental results demonstrate that the proposed machine-generated text detection method, based on frequency domain feature extraction and local frequency filtering, can effectively model text structure information in both the feature space and frequency domain. On the one hand, low-frequency suppression and mid-to-high-frequency preservation can mitigate the global shift caused by cross-domain migration, highlighting the fine-grained structural differences between machine-generated and human text. On the other hand, spectral reconstruction and frequency domain alignment constraints can reduce the spectral distribution differences of similar samples under different domains or generator conditions, thereby achieving robust machine-generated text detection with stable prediction results, stronger generalization performance, and high practical value.

[0056] Although illustrative specific embodiments of the present invention have been described above to facilitate understanding by those skilled in the art, it should be understood that the present invention is not limited to the scope of the specific embodiments. Various modifications will be apparent to those skilled in the art as long as they fall within the spirit and scope of the invention as defined and established by the appended claims, and all inventions utilizing the inventive concept are protected.

Claims

1. A machine-generated text detection method based on frequency domain feature extraction and local frequency filtering, characterized in that, Includes the following steps: Step 1: Perform embedding transformation on the input text and construct an initial frequency domain representation for subsequent detection of significant frequency components and frequency band division; Step 2: Construct a local frequency filtering module. Based on the spectral features in the initial frequency domain representation, extract local salient features of the text in different frequency bands through peak detection and frequency band mask generation, and form a multi-band local frequency representation. Step 3: Perform statistical analysis on the overall text spectrum data in the initial frequency domain representation, establish a global frequency domain pattern, and combine the multi-band local frequency representation to construct a global frequency domain representation that spans text and models; Step 4: Jointly model the text features in the time domain and frequency domain representation spaces. Obtain a unified frequency domain representation by weighted reconstruction of mid-frequency and high-frequency components, and map it back to the original feature domain through inverse discrete Fourier transform, thereby constructing a unified discriminant representation for machine-generated text detection. Step 5: During the joint learning process, the local frequency filtering module, spectrum reconstruction and discrimination network are jointly optimized end-to-end. Robust detection is achieved by synergistically minimizing the classification loss and frequency domain alignment loss, and the text authenticity prediction result is output.

2. The machine-generated text detection method based on frequency domain feature extraction and local frequency filtering according to claim 1, characterized in that, Step 1, which involves performing an embedding transformation on the input text and constructing an initial frequency domain representation, is implemented as follows: Step 1.1: Segment or encode the input text to obtain a token sequence representation, and use the word vectors or hidden states of the pre-trained language model to map to a continuous embedding space to obtain a text embedding sequence; Step 1.2: Perform a Fast Fourier Transform on the text embedding sequence to obtain the amplitude spectrum. Phase spectrum The amplitude spectrum Phase spectrum is used to reflect the energy distribution across different frequency bands. Used to describe changes in sequence structure; Step 1.3, the amplitude spectrum The average amplitude curve is obtained by averaging the positions, and it serves as the basic template for subsequent local frequency significance detection.

3. The machine-generated text detection method based on frequency domain feature extraction and local frequency filtering according to claim 2, characterized in that, In step 1.1, the pre-trained language model is a decoder-based or encoder-based language model, and the text embedding sequence is represented as follows: , It is the first n One word, The number of tokens is denoted by the word dimension, which is the latent space dimension of the pre-trained language model. In step 1.2, the Fast Fourier Transform (FFT) or rFFT is used to perform a one-dimensional transformation along the token dimension of the text embedding sequence to obtain a frequency domain representation, thereby obtaining the amplitude spectrum. Phase spectrum The amplitude spectrum Obtained by taking the modulus of the frequency domain coefficients; In step 1.3, the average amplitude curve is obtained by analyzing the amplitude spectrum. The average amplitude curve is obtained by averaging over a preset dimension and serves as a reference template for subsequent local frequency saliency detection, used to stabilize the amplitude scale differences between different text lengths and different samples.

4. The machine-generated text detection method based on frequency domain feature extraction and local frequency filtering according to claim 1, characterized in that, Step 2 is implemented as follows: Step 2.1: Obtain the amplitude spectrum based on the spectral characteristics. The average amplitude curve is obtained by averaging according to position. Based on the average amplitude curve, the high significant frequency points of the text are identified by the local peak detection algorithm, and divided into three categories: high frequency, medium frequency and low frequency according to their relative intensity. Step 2.2: Construct a corresponding frequency domain mask for each frequency band, including a high-frequency mask, a mid-frequency mask, and a low-frequency mask, which are used to extract the energy concentration patterns of the text in different frequency bands. Step 2.3: Calculate the local peak features and non-peak mean features for each frequency band to obtain the high-frequency feature vector after local frequency filtering. Mid-frequency eigenvectors With low-frequency feature vectors Then, the frequencies are spliced ​​or weighted and fused to obtain a complete multi-band local frequency representation. .

5. The machine-generated text detection method based on frequency domain feature extraction and local frequency filtering according to claim 4, characterized in that, Step 2.1, the local peak detection algorithm includes: comparing each frequency position with its neighborhood amplitude value on the average amplitude curve, determining the frequency position that satisfies the local maximum and is significantly higher than the neighborhood mean or threshold as a significant frequency point, and classifying it into three categories: high frequency, mid frequency and low frequency according to the relative amplitude intensity or frequency range of the significant frequency point. In step 2.2, the frequency domain mask is a binary or continuous weight vector with the same dimension as the frequency domain coefficients; wherein, the frequency positions belonging to the corresponding frequency band are assigned a value of 1 or a weight greater than 0, and the frequency positions not belonging to the corresponding frequency band are assigned a value of 0, thereby achieving selective preservation of frequency domain components of different frequency bands; Step 2.3, calculating the local peak features and non-peak mean features for each frequency band, includes: aggregating the amplitude values ​​of the frequency positions identified as peaks within the frequency band to obtain peak statistics, and aggregating the amplitude values ​​of the non-peak positions within the frequency band to obtain non-peak mean statistics, thereby forming the frequency domain feature vector after local frequency filtering for the corresponding frequency band. .

6. The machine-generated text detection method based on frequency domain feature extraction and local frequency filtering according to claim 1, characterized in that, Step 3 is implemented as follows: Step 3.1: Based on the total amplitude spectrum data, establish a global frequency distribution statistic; Step 3.2: Construct a global frequency domain representation by combining the multi-band local frequency representation with the global frequency distribution statistics through a feature fusion network. , used to characterize the structural consistency of text across the entire frequency band; Step 3.3: Based on the changing trend of frequency energy in different frequency bands and the coupling characteristics between frequency bands, construct a frequency domain discrimination mode to distinguish between machine-generated text and human text.

7. The machine-generated text detection method based on frequency domain feature extraction and local frequency filtering according to claim 6, characterized in that, Step 3.1, the global frequency distribution statistics include at least: global average energy, energy density change rate, and energy center migration characteristics; wherein the global average energy is used to describe the overall spectral energy level, the energy density change rate is used to describe the trend of spectral energy change with frequency, and the energy center migration characteristics are used to describe the degree of shift of the energy center of gravity between frequency bands. In step 3.2, the feature fusion network is any one or a combination of linear layers, multilayer perceptrons, or lightweight Transformers to characterize the structural consistency of text across the entire frequency band.

8. The machine-generated text detection method based on frequency domain feature extraction and local frequency filtering according to claim 1, characterized in that, Step 4 is implemented as follows: Step 4.1: Encode the input text using a pre-trained language model to obtain a feature space representation, and then divide it into high-frequency feature vectors according to frequency bands in the frequency domain. Mid-frequency eigenvectors With low-frequency feature vectors ; Step 4.2, based on the idea of ​​local frequency filtering, suppresses domain-sensitive but task-independent low-frequency components. Filtering or zeroing is performed to retain only the mid-to-high frequencies, which are then concatenated to form the filtered frequency domain representation. ,in Indicates a splicing operation; Step 4.3, based on the input of a batch containing... The nth sample, for the nth The reconstructed frequency domain features in the frequency domain space are obtained by reconstructing the spectrum of each sample. Furthermore, by performing an inverse frequency domain transformation, the frequency domain space is mapped back to the time domain space to obtain the transformed natural text feature representation. That is, the unified discriminant representation, wherein , It is the first The mid-frequency feature vector and high-frequency feature vector of each sample.

9. The machine-generated text detection method based on frequency domain feature extraction and local frequency filtering according to claim 8, characterized in that, In step 4.1, the feature space representation is treated as a one-dimensional discrete signal, and a 1D DFT or rFFT is performed on it to obtain a set of frequency domain coefficients, which are then divided into high-frequency feature vectors. Mid-frequency eigenvectors With low-frequency feature vectors ; In step 4.3, during the spectrum reconstruction stage, the average amplitude statistics are calculated for the mid-frequency feature vector and the high-frequency feature vector within a batch. and compared with the average amplitude of the corresponding frequency band of the entire training set. , Alignment yields weighting coefficients for frequency band recalibration. Based on this, the mid-to-high frequency components are weighted and reconstructed to obtain the final frequency domain features. .

10. The machine-generated text detection method based on frequency domain feature extraction and local frequency filtering according to claim 1, characterized in that, Step 5 is implemented as follows: Step 5.1: Using the unified discriminant representation as the classification input, the lightweight discriminant head outputs machine-generated or human-written predictions, and the cross-entropy classification loss is calculated based on the real labels. ; Step 5.2: In the frequency domain, for samples with the same label within the same batch, minimize the average frequency domain features between the samples. Distance, resulting in frequency domain alignment loss To reduce the differences in spectral distribution of similar samples under different domain / different generator conditions; Step 5.3: Sum the classification loss and the frequency domain alignment loss to obtain the overall optimization objective. Furthermore, a stochastic gradient descent optimizer is used to jointly update the encoder, local frequency filtering module, learnable part in the spectrum reconstruction process, and discriminator, thereby achieving collaborative learning of frequency domain information and feature space information. Step 5.4: In the inference phase, reuse the same process as during training and directly output the prediction result of the machine-generated text or its corresponding confidence score as the input text.