AdaDetectGPT: Adaptive Detection of LLM-Generated Text with Statistical Guarantees

Hongyi Zhou, Jin Zhu, Pingfan Su, Kai Ye, Ying Yang, Shakeel A O B Gavioli-Akilagun, Chengchun Shi

TL;DR

AdaDetectGPT enhances logits-based LLM text detectors by learning an adaptive "witness function" from training data to transform raw token log-probabilities into a more discriminative space. By framing sequential token generation as a martingale process, the method provides rigorous statistical guarantees on error rates while boosting detection accuracy (AUC) by up to 37% over state-of-the-art baselines.

What Problem Does This Paper Address?

As large language models (LLMs) become increasingly adept at mimicking human writing, the risks of misinformation, academic dishonesty, and eroded trust grow. Consequently, building reliable tools to differentiate between human- and LLM-generated text is a critical challenge.

Existing zero-shot, statistics-based detectors (such as DetectGPT and Fast-DetectGPT) typically analyze the log-probabilities (logits) of tokens under a source LLM. They operate on the empirical observation that machine-generated text tends to yield higher log-probabilities or distinct conditional probability curvatures compared to human text. However, relying purely on raw log-probabilities is sub-optimal; human and machine text distributions often overlap in complex ways that raw logits fail to capture. Furthermore, the field largely lacks systematic statistical analysis, leaving detectors without formal performance guarantees on standard classification metrics like the False Negative Rate (FNR).

Methods

AdaDetectGPT bridges the gap between purely statistics-based and machine learning-based detection. Instead of using raw log-probabilities directly, it introduces a learned, one-dimensional witness function ($w$) that transforms the logits to maximize the separation between human and machine text.

Figure 1: Workflow of AdaDetectGPT. Built upon Fast-DetectGPT (Bao et al., 2024), our method adaptively learn a witness function bw from training data by maximizing a lower bound on the TNR, while using normal approximation for FNR control.

The core methodology consists of two main components:

  1. Adaptive Learning via TNR Optimization: The authors derive a theoretical lower bound on the True Negative Rate (TNR). AdaDetectGPT learns the witness function by maximizing this lower bound using external training data. By parameterizing the witness function with a B-spline basis, this optimization elegantly reduces to solving a simple system of linear equations.
  2. FNR Control via Martingale Theory: Because text is generated sequentially, the authors model the token log-probabilities as a time-dependent sequence. By applying the Martingale Central Limit Theorem (MCLT), they prove that the detection statistic asymptotically follows a standard normal distribution when evaluating machine-generated text. This allows users to analytically select a classification threshold that strictly controls the FNR at a pre-specified significance level ($\alpha$).

The method supports both white-box settings (where the detector has full access to the target LLM's logits) and black-box settings (where an open-source surrogate model is used to approximate the hidden target LLM's logits).

Datasets

The authors evaluated AdaDetectGPT across five widely used text datasets, spanning various generation tasks:

  • SQuAD: Wikipedia-style question answering.
  • WritingPrompts: Creative story generation.
  • XSum: Professional news summarization.
  • Yelp: Crowd-sourced product and service reviews.
  • Essay: High school and university-level student essays.

To simulate a challenging, realistic setup, paragraphs were generated by providing an LLM with the first 120 tokens of a human-written text and letting it complete the passage with up to 200 tokens. The witness function was always trained on two datasets completely distinct from the test dataset to ensure generalization.

Key Insights and Ideas

  • The Limitation of Raw Logits: The authors present an analytical "Kingdom of Bit" example showing that if an LLM's token distribution approaches a uniform state, traditional detectors relying on raw log-probabilities fail entirely—regardless of the actual distance between the human and machine distributions. An adaptive witness function bypasses this bottleneck by learning non-linear transformations that expose subtle distributional differences.
  • Text as a Martingale: Framing sequential token probabilities as a martingale difference sequence provides a mathematically principled foundation for text detection. It unlocks the power of normal approximations for threshold selection, moving the field away from heuristic threshold tuning.
Figure 2: Boxplots visualizing the differences in the statistical measures between human- and LLM- authored passages, comparing AdaDetectGPT (with a learned witness function) and Fast-DetectGPT (without it). A larger positive difference from zero indicates better detection power. As observed, the difference computed by AdaDetectGPT is consistently larger than that of Fast-DetectGPT across the first quartile, median, and third quartile. The left panel shows statistics evaluated on the SQuAD dataset, while the right panel displays results for the WritingPrompts dataset.

Key Results

  • Superior White-Box Accuracy: AdaDetectGPT consistently achieved the highest Area Under the Curve (AUC) across all combinations of datasets and source models (including GPT-2, OPT, GPT-Neo, GPT-J, LLaMA3, Qwen2.5, and Mistral), outperforming Fast-DetectGPT by 12.5% to 37%.
  • Robust Black-Box Detection: When testing against closed-source models like GPT-4o and Claude-3.5-Haiku using an open-source surrogate (Gemma-2-9b), AdaDetectGPT maintained a clear edge, providing AUC improvements of up to 20% generally, and up to 37.8% on the Essay dataset.
  • Empirical FNR Control: As predicted by the Martingale CLT, the empirical FNR tightly tracked the target significance level $\alpha$ across multiple datasets and models, proving the reliability of the statistical guarantees in practice.
Figure 3: Top panel: FNR of the classifier plotted against the significance level α. Bottom panel: Distribution of statistics evaluated on LLM-generated text. The dashed red line is the density function of standard normal random variable. Results are shown across three datasets (from left to right) and two language models (indicated by different colors).
  • High Efficiency: Training the adaptive witness function is incredibly fast, typically taking less than one minute and consuming under 0.5 GB of memory.

Limitations and Future Work

  • Sampling Parameter Mismatch: The strict mathematical guarantees assume that the text generation exactly follows the target model's true conditional probabilities. However, real-world LLM deployment often utilizes sampling parameters like temperature tuning or top-$k$/top-$p$ filtering. The authors note that while this mismatch technically invalidates the strict MCLT assumptions, empirically it causes the statistic to shift toward a positive mean, making the FNR control conservative rather than inaccurate.
  • Surrogate Quality in Black-Box Settings: In black-box scenarios, the detector's performance remains bounded by how well the open-source surrogate model mirrors the vocabulary and style of the closed-source target model. Future work could explore optimizing surrogate selection or combining multiple surrogates to improve black-box robustness.

Summary updated

Abstract

We study the problem of determining whether a piece of text has been authored by a human or by a large language model (LLM). Existing state of the art logits-based detectors make use of statistics derived from the log-probability of the observed text evaluated using the distribution function of a given source LLM. However, relying solely on log probabilities can be sub-optimal. In response, we introduce AdaDetectGPT -- a novel classifier that adaptively learns a witness function from training data to enhance the performance of logits-based detectors. We provide statistical guarantees on its true positive rate, false positive rate, true negative rate and false negative rate. Extensive numerical studies show AdaDetectGPT nearly uniformly improves the state-of-the-art method in various combination of datasets and LLMs, and the improvement can reach up to 37\%. A python implementation of our method is available at https://github.com/Mamba413/AdaDetectGPT.
BibTeX
@inproceedings{zhou2025adadetectgpt,
  author = {Hongyi Zhou and Jin Zhu and Pingfan Su and Kai Ye and Ying Yang and Shakeel A O B Gavioli-Akilagun and Chengchun Shi},
  title = {{AdaDetectGPT: Adaptive Detection of LLM-Generated Text with Statistical Guarantees}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=3Qo2SRcHgU},
}
Figure