Kill two birds with one stone: generalized and robust AI-generated text detection via dynamic perturbations

Yinghan Zhou, Juan Wen, Wanli Peng, Yiming Xue, Ziwei Zhang, Zhengxian Wu

Abstract

As large language models (LLMs) proliferate, distinguishing machine-generated text from human writing has become a critical security challenge. Existing detectors often struggle with generalization to unseen models and lack robustness against adversarial "evasion" tactics. We present DP-Net (Dynamic Perturbation Network), a novel framework that treats domain shifts and adversarial attacks as related distributional perturbations. By employing Reinforcement Learning (RL) to dynamically inject noise into training data, DP-Net achieves state-of-the-art performance in cross-domain detection and adversarial resilience.

Introduction

The rapid advancement of LLMs has made AI-generated text nearly indistinguishable from human prose, leading to concerns regarding misinformation and academic integrity. "Black-box" detectors, while practical, face two primary hurdles: poor generalization across different LLM architectures and vulnerability to simple text manipulations such as paraphrasing. Traditional approaches treat these as separate issues. This work proposes that both generalization and robustness can be addressed by training models to be invariant to data perturbations.

Methodology: The DP-Net Framework

DP-Net utilizes a Reinforcement Learning (RL) agent to optimize the training process. Instead of static data augmentation, the system dynamically adjusts the noise injected into text embeddings.

Architecture

  1. Encoder: A RoBERTa-based model transforms input text into high-dimensional embeddings.
  2. Dynamic Perturbation Agent: Using the Deep Deterministic Policy Gradient (DDPG) algorithm, an RL agent acts as a "coach." It continuously tunes the mean ($\mu$) and variance ($\sigma^2$) of Gaussian noise added to the embeddings.
  3. Training Objective: The detector is trained to align noisy embeddings with their original clean counterparts using a feature alignment loss ($L_{dis}$). This forces the model to ignore surface-level artifacts and focus on robust semantic features.
t-SNE visualization of feature distributions under different training regimes: noiseless, fixed noise, and dynamic noise (DP-Net).

As shown in the t-SNE visualizations, dynamic noise training significantly improves the separation between AI and human-generated text clusters compared to noiseless or fixed-noise baselines.

Experimental Results

The model was evaluated on the M4 and RAID benchmarks, covering diverse generators (ChatGPT, Llama-3, etc.) and domains (Wikipedia, Reddit, etc.).

Generalization and Robustness

DP-Net achieved an average cross-domain accuracy of 86.10%, outperforming baselines by over 5%. In adversarial scenarios, it maintained 91.25% accuracy against synonym replacement and 68.73% against sophisticated paraphrase attacks—a significant leap over existing methods.

Performance sensitivity of the detector to varying mean and standard deviation of injected noise.

The sensitivity analysis indicates that while fixed noise levels can improve performance in specific contexts, the RL agent's ability to navigate the "noise landscape" is crucial for achieving broad-spectrum robustness.

Efficiency

Despite the added complexity of RL training, DP-Net remains highly efficient. Inference for 2,000 samples takes approximately 35.53 seconds, making it suitable for real-time applications.

Discussion and Future Work

The success of DP-Net suggests that "robustness" and "generalization" are two sides of the same coin. By training against dynamic perturbations, the model learns domain-invariant features. However, challenges remain:

  • Paraphrasing: While DP-Net improves upon the state-of-the-art, the ~68% accuracy against paraphrasing indicates that "humanizing" AI text remains a potent evasion strategy.
  • Theoretical Foundations: Future work will focus on providing a formal mathematical proof for the optimality of the dynamic perturbation mechanism and exploring multi-source training to further enhance generalization.

Conclusion

DP-Net demonstrates that dynamic, RL-driven data perturbation is a powerful tool for building AI text detectors that are both generalizable and robust. By unifying the treatment of domain shifts and adversarial attacks, it sets a new benchmark for reliable AI content identification.

Summary updated

BibTeX
@inproceedings{zhou2025kill,
  author = {Yinghan Zhou and Juan Wen and Wanli Peng and Yiming Xue and Ziwei Zhang and Zhengxian Wu},
  title = {{Kill two birds with one stone: generalized and robust AI-generated text detection via dynamic perturbations}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.naacl-long.446},
}
Figure