Breaking the Generator Barrier: Disentangled Representation for Generalizable AI-Text Detection

April 15, 2026 Β· View on GitHub

Detecting AI-generated text in open-world scenarios is fundamentally challenged by the rapid emergence of unseen generators, where model-specific artifacts undermine the generalization of existing detectors. Most approaches rely on identifying "fingerprints" of known Large Language Models (LLMs), ignoring the latent semantic discrepancies shared across different generators. In this work, we challenge this reliance on surface-level shortcuts and propose a progressively structured framework that explicitly disentangles AI-detection semantics from generator-aware artifacts. By employing compact latent encoding and perturbation-based regularization, our method minimizes semantic entanglement and aligns representations with task objectives. This design enables robust detection across diverse, unseen models without sacrificing sensitivity to AI-specific cues. Experiments on the MAGE benchmark, covering 20 representative LLMs, demonstrate consistent improvements over state-of-the-art methods, achieving up to 24.2% accuracy gain. Beyond performance, our approach offers a new perspective on generalizable detection, revealing that stripping away generator-specific noise is key to capturing the universal essence of machine-generated text.

πŸš€ Features

  • Progressive Framework: Employs a structured approachβ€”starting with compact latent encoding, followed by perturbation-based regularization, and ending with discriminative adaptationβ€”for superior representation learning.
  • Scalable Performance: Demonstrates strong scalability in open-set scenarios, with performance consistently improving as the diversity of training generators increases, achieving significant gains in accuracy and F1 score.
  • Comprehensive Metrics: Evaluates performance using multiple metrics (Accuracy, F1, ASR.)

πŸ“‹ Prerequisites

System Requirements

  • Python >= 3.8
  • CUDA-compatible GPU (recommended for training)
  • Sufficient RAM for processing large datasets

Dependencies

Instead of installing packages manually, we have provided an environment.yml file for easier setup. You can create the environment and install all dependencies automatically by running:

conda env create -f environment.yml

πŸ“¦ Data Preparation

Prepare your dataset in the following format:

  • article
  • label (machine/human)
  • index (bloom/gpt3.5...)

🧰 Base Model

We employ the BERT model initialized with random weights (without pre-trained checkpoints) and conduct full fine-tuning on the downstream task.

πŸš€ Usage

Training

To train the model, run:

python train.py

Testing

To evaluate the trained model, run:

python test.py

πŸ—οΈ Architecture

The system is organized as follows:

DRGD/
β”œβ”€β”€ data/                  # Data loading and preprocessing
β”œβ”€β”€ module/                # Model implementations
β”œβ”€β”€ tools/                 # Utilities (metrics, preprocessing, etc.)
β”œβ”€β”€ train.py               # Main entry point
└── test.py                # Inference script

πŸ“Š Evaluation Metrics

The framework includes comprehensive evaluation metrics:

  • Accuracy
  • F1-score
  • ASR (Attack Success Rate)

πŸ“š Citation

If you use this code in your research, please cite:

@article{pu2026breaking,
  title={Breaking the Generator Barrier: Disentangled Representation for Generalizable {AI}-Text Detection},
  author={Pu, Xiao and Cheng, Zepeng and Yuan, Lin and Wu, Yu and Bi, Xiuli},
  journal={Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics},
  year={2026}
}

πŸ” License

This project is licensed under the MIT License - see the LICENSE file for details.