🧠 Human Texts Are Outliers: Detecting LLM-generated Texts via Out-of-Distribution Detection (NeurIPS 2025)

October 15, 2025 Β· View on GitHub

πŸ“š Paper

Human Texts Are Outliers: Detecting LLM-generated Texts via Out-of-Distribution Detection
Cong Zeng*, Shengkun Tang*, Yuanzhou Chen, Zhiqiang Shen, Wenchao Yu, Xujiang Zhao, Haifeng Chen, Wei Cheng†, Zhiqiang Xu†
NeurIPS 2025

πŸ“„ Paper


Overview


πŸ“˜ Overview

This repository implements an Out-of-Distribution (OOD) detection framework, reframing human text detection as an OOD task. Instead of treating human and machine text as two balanced classes, we model LLM-generated text as in-distribution (ID) and human-written text as out-of-distribution (OOD).

We introduce a suite of OOD-based detectors β€” DeepSVDD, HRN, and Energy-based methods β€” that achieve state-of-the-art (SoTA) detection performance across multilingual, adversarial, and unseen-model scenarios.

πŸ§ͺ Datasets

DatasetDescriptionFocus
DeepFake27 LLMs + multi-domain human textCross-domain & model generalization
M4Multi-lingual, multi-domain datasetMultilingual robustness
RAIDAdversarially perturbed LLM textAttack robustness

You can download DeepFake and M4 dataset from Google Drive. You can find our pre-processed RAID dataset on Huggingface. (You don't need to download yourself, the script will download the dataset automatically).

βš™οΈ Installation

Using Conda

conda create -n ood_llm_detect python=3.10
conda activate ood_llm_detect
pip install -r requirements.txt

Inference Demo

We provide a simple inference demo. You can input a sentence or paragraph and obtain the results directly. Please first download the weights from google drive.

python infer.py --model_path xxxx/model_classifier_best.pth --ood_type deepsvdd --mode deepfake --out_dim 768

Training

We provide all training scripts in 3 setting including DeepSVDD, HRN and Energy-based methods.

# DeepSVDD setting
bash script/train_dsvdd.sh

# HRN setting
bash script/train_hrn.sh

# Energy setting
bash script/train_energy.sh

Evaluation

After training, you can use the weights to do inference using our scripts:

# DeepSVDD setting
bash script/test_dsvdd.sh

# HRN setting
bash script/test_hrn.sh

# EnergyKv setting
bash script/test_energy.sh

We provide our pretrained weights in DeepSVDD setting to reproduce the results in our paper. You can download the weights from google drive.

Acknowledgement

We gratefully acknowledge that our codebase is largely built upon the DeTeCtive library. We thank the authors and contributors for their valuable open-source work and weights, which significantly facilitated our research and development.

Citation

If you use our code or findings in your research, please cite us as:

@misc{zeng2025humantextsoutliersdetecting,
      title={Human Texts Are Outliers: Detecting LLM-generated Texts via Out-of-distribution Detection}, 
      author={Cong Zeng and Shengkun Tang and Yuanzhou Chen and Zhiqiang Shen and Wenchao Yu and Xujiang Zhao and Haifeng Chen and Wei Cheng and Zhiqiang Xu},
      year={2025},
      eprint={2510.08602},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2510.08602}, 
}