DetectAnyLLM: Towards Generalizable and Robust Detection of Machine-Generated Text Across Domains and Models

Jiachen Fu, Chun-Le Guo, Chongyi Li

Introduction

The proliferation of Large Language Models (LLMs) has made the distinction between human-written text (HWT) and machine-generated text (MGT) a critical frontier for digital safety and information integrity. Despite the urgency, existing Machine-Generated Text Detection (MGTD) tools often struggle with a "generalization gap." Zero-shot detectors frequently lack the sensitivity required for nuanced tasks, while supervised, training-based detectors often overfit to specific training distributions, failing when faced with new models or domains.

The Shift to Task-Oriented Learning

A core contribution of this work is the identification of the "model-oriented" trap. Traditional training methods, such as Direct Preference Optimization (DPO), often employ KL-regularization to keep the detector's distribution close to a reference LLM. While useful for alignment, the authors argue this constraint is counterproductive for detection. It forces the model to retain generative capabilities that distract from the primary task: identifying the subtle statistical discrepancies inherent in AI-generated text.

Methodology: DetectAnyLLM

The DetectAnyLLM framework introduces two primary innovations designed to move toward a "task-oriented" detection paradigm.

Direct Discrepancy Learning (DDL)

DDL is a novel optimization strategy that strips away the redundant constraints of standard preference learning. By removing the identity-preserving KL-regularization, DDL allows the scoring model to focus exclusively on the log-probability discrepancy. This discrepancy measures the difference in how a model evaluates a text versus a perturbed version of that same text. This approach enables the model to "forget" how to generate text and instead specialize in the discrepancy space where human and machine signatures diverge most significantly.

Reference Clustering

To improve decision-making in the field, DetectAnyLLM replaces static global thresholds with Reference Clustering. This local statistical method compares a target text's discrepancy score against a small, curated reference set of known HWT and MGT. By using an adaptive search window, the system can more accurately estimate the probability of machine origin, making it more robust to varying text lengths and styles.

The MIRAGE Benchmark

To evaluate DetectAnyLLM in realistic settings, the authors developed MIRAGE (Multi-domain Inclusive Realistic Assessment for machine Generated text dEtection). MIRAGE is currently the most comprehensive MGTD benchmark, featuring:

  • Scale: 93.8K HWT-MGT pairs.
  • Diversity: Data from 17 state-of-the-art LLMs, including GPT-4o, Claude-3.7-Sonnet, and DeepSeek-R1.
  • Domains: Coverage across Academic, News, Comment, Email, and Website content.
  • Complexity: Inclusion of "Polishing" and "Rewriting" tasks, which are significantly more difficult to detect than raw generation.

Key Findings and Performance

DetectAnyLLM demonstrates a significant leap in detection capability across multiple benchmarks:

  • Performance Leap: On the MIRAGE-DIG (Disjoint-Input Generation) subset, the model achieved an average 0.9352 AUROC, a 65.8% improvement over previous state-of-the-art training-based methods like ImBD.
  • High Precision: In Shared-Input Generation (SIG) scenarios, it reached a TPR@5% of 0.7779, successfully identifying nearly 78% of AI text with a very low 5% false positive rate.
  • Efficiency Gains: By eliminating the need for a reference model during training, DDL reduces training time by approximately 30.12% and VRAM usage by 35.90%.
  • Robustness: The model remains effective across 16 different writing styles (e.g., poetic, academic), suggesting that it learns features deeper than mere stylistic markers.

Conclusion and Future Directions

DetectAnyLLM represents a significant step toward robust, generalizable AI detection. By prioritizing task-specific discrepancy learning over model-alignment constraints, it achieves superior performance with lower computational overhead. While the method shows remarkable resilience, future work will address the dependency on log-probability access for proprietary models and explore defenses against active adversarial editing where humans manually refine AI output to bypass detection.

Summary updated

BibTeX
@inproceedings{fu2025detectanyllm,
  author = {Jiachen Fu and Chun-Le Guo and Chongyi Li},
  title = {{DetectAnyLLM: Towards Generalizable and Robust Detection of Machine-Generated Text Across Domains and Models}},
  booktitle = {ACM Multimedia},
  year = {2025},
  doi = {10.1145/3746027.3754862},
}
Figure