Source-linked AI summary
Fast-DetectGPT: Efficient Zero-Shot Detection of Machine-Generated Text via Conditional Probability Curvature
Guangsheng Bao, Yanbin Zhao, Zhiyang Teng, Linyi Yang, Yue Zhang
TL;DR
Reliable detection of machine-generated text is needed because fluent LLM output is difficult to distinguish from human writing, while DetectGPT is computationally expensive. Fast-DetectGPT uses conditional probability curvature with token-level sampling and scoring, achieving approximately 75% higher detection accuracy in both white-box and black-box settings while greatly reducing inference cost.
Problem
Fluent and coherent LLM output makes machine-generated text difficult to distinguish from human-authored content, while DetectGPT’s perturbation-based detection is computationally expensive.
Method
Fast-DetectGPT detects authorship using conditional probability curvature, comparing passage-token probabilities with distributions from sampled alternative tokens in context.
Results
Approximately 75% higher detection accuracy was reported in both white-box and black-box settings, alongside a roughly 340x inference speedup over DetectGPT.
Takeaways & Limitations
Conditional probability curvature provides a more efficient zero-shot feature for distinguishing machine-generated from human-authored text across the evaluated settings.
Takeaways & Limitations
In black-box settings, no single pre-trained model seamlessly spans all languages and domains, limiting coverage across linguistic territories and domains.
Abstract
from arXiv · showhide
Large language models (LLMs) have shown the ability to produce fluent and cogent content, presenting both productivity opportunities and societal risks. To build trustworthy AI systems, it is imperative to distinguish between machine-generated and human-authored content. The leading zero-shot detector, DetectGPT, showcases commendable performance but is marred by its intensive computational costs. In this paper, we introduce the concept of conditional probability curvature to elucidate discrepancies in word choices between LLMs and humans within a given context. Utilizing this curvature as a foundational metric, we present **Fast-DetectGPT**, an optimized zero-shot detector, which substitutes DetectGPT's perturbation step with a more efficient sampling step. Our evaluations on various datasets, source models, and test conditions indicate that Fast-DetectGPT not only surpasses DetectGPT by a relative around 75% in both the white-box and black-box settings but also accelerates the detection process by a factor of 340, as detailed in Table 1. See \url{https://github.com/baoguangsheng/fast-detect-gpt} for code, data, and results.
1 INTRODUCTION
The paper motivates zero-shot detection of machine-generated text because LLM fluency makes authorship difficult to determine, while existing detectors face domain or computational limitations. It proposes conditional probability curvature and Fast-DetectGPT to improve detection efficiency and accuracy.
- LLM fluency and coherence make it difficult even for experts to distinguish machine-generated from human-authored text.
- Supervised detectors perform well in their training domains but degrade on diverse domains or unfamiliar models, motivating zero-shot alternatives.
- DetectGPT uses probability curvature but requires around one hundred model calls to generate and assess perturbations, creating prohibitive computational costs.
- Conditional probability curvature captures differences in how humans and machines choose tokens given context, with machine-generated text expected to form a positive-curvature maximum.
- Fast-DetectGPT replaces DetectGPT’s perturbation process with sampling and reports about a 75% relative accuracy boost in both white-box and black-box settings.
- The paper identifies conditional probability curvature as a feature that reduces detection cost by two orders of magnitude and achieves the best average accuracy among compared zero-shot detectors.
2 METHOD
Fast-DetectGPT replaces whole-text perturbation scoring with token-level conditional sampling and scoring. Its curvature statistic compares the observed token choices with sampled alternatives, enabling efficient detection without repeatedly reevaluating entire perturbed sequences.
- DetectGPT Baseline: DetectGPT estimates probability curvature by perturbing the passage, scoring the original and rewrites, and comparing their probabilities.
- DetectGPT Baseline: Reevaluating the full Markov chain for each slight perturbation requires repeated scoring, so Fast-DetectGPT instead evaluates conditional probabilities token by token.
- Fast-DetectGPT: Fast-DetectGPT assumes machines favor higher-probability tokens, whereas humans choose words according to meanings, intentions, and contexts rather than corpus statistics.
- Fast-DetectGPT: The sample mean and variance estimate the expected conditional scores and their variance for the curvature statistic.
- Fast-DetectGPT: The method samples alternative tokens independently under the fixed passage context and places each passage token’s score within the alternatives’ score distribution.
- Fast-DetectGPT: Fast-DetectGPT uses sampling, conditional scoring in a single predictive distribution, and comparison to produce the detection decision without multiple scoring-model calls.
- Fast-DetectGPT: When sampling and scoring use one model, the sampling and scoring steps can merge into one model call, and the curvature numerator combines likelihood with entropy.
3 EXPERIMENTS
Experiments evaluate Fast-DetectGPT across diverse datasets, source models, settings, and robustness conditions. It achieves strong detection performance while substantially reducing inference cost relative to DetectGPT.
- Main results: 79,113 seconds versus 233 seconds yields an approximately 340x inference speedup for Fast-DetectGPT over DetectGPT across five runs on XSum generations.The comparison uses a Tesla A100 GPU and excludes model initialization time.
- Main results: Fast-DetectGPT achieves the best average AUROC across XSum, SQuAD, and WritingPrompts, outperforming DetectGPT by 74.7% and NPR by 68.2% in the white-box setting.The relative improvement increases with larger source models.
- Main results: 74.5% relative AUROC improvement over DetectGPT is achieved across datasets in the black-box setting using GPT-J and Neo-2.7.Fast-DetectGPT also outperforms DetectGPT by 27.6% on average under the compared configurations.
- Real-world scenarios: 78.3% and 75.1% relative AUROC margins over DetectGPT are reported for ChatGPT and GPT-4 generations, respectively, in black-box real-world evaluations.Fast-DetectGPT also achieves higher overall accuracy than RoBERTa-base/large and GPTZero in these evaluations.
- Usability analysis: 87% recall at a 1% false-positive rate and 98% recall at 10% false positives are achieved on ChatGPT text, while GPT-4 reaches 89% recall below 10% false positives.The GPT-4 detection task is described as significantly more challenging.
- Robustness: Fast-DetectGPT consistently outperforms DetectGPT across top-k, top-p, and temperature sampling strategies and remains robust across domains, languages, and paraphrasing attacks.It significantly outperforms supervised detectors on out-of-distribution PubMedQA and WMT16-German, while achieving competitive accuracy on XSum and WMT16-English.
4 DISCUSSION
Fast-DetectGPT shows stronger white-box performance than black-box performance, while its black-box applicability and theoretical foundations remain important open questions. The method also faces domain and language coverage challenges because it relies on pretrained models.
- Fast-DetectGPT performs about 65% better in white-box settings than black-box ones.
- The best model for black-box detection remains unclear and may depend on model size, corpus breadth, and training convergence.
- The paper also discusses broader implications for text authorship and watermarking.
- The paper focuses on empirical acceleration and accuracy improvements, leaving theoretical exploration for future work.
- Black-box deployment is challenged by the lack of a single pretrained model covering all languages and domains.
5 RELATED WORK
Related work spans supervised and zero-shot detection approaches, with zero-shot detectors relying primarily on statistical features extracted from pretrained language models.
- Supervised methods train classifiers using bag-of-words or neural representations to distinguish machine-generated from human-written text.
- Zero-shot detectors use statistical features including entropy, perplexity, likelihood, probability curvature, and normalized log-rank perturbation.
6 CONCLUSION
The paper concludes that token-level conditional probability curvature is a fundamental indicator of machine-generated text. Fast-DetectGPT builds on this finding to improve both detection efficiency and accuracy.
- Token-level conditional probability curvature serves as a more fundamental indicator of machine-generated text.
- Fast-DetectGPT accelerates DetectGPT by two orders of magnitude.
- Approximately 75% accuracy improvement is achieved in both white-box and black-box settings.
ETHICAL CONSIDERATIONS AND BROADER IMPACT
Fast-DetectGPT may help address harms associated with generated text, but its reliance on LLMs raises bias and inclusivity concerns. The paper suggests using more varied and representative training corpora.
- Fast-DetectGPT holds promise for combating fake news, disinformation, and academic plagiarism.
- LLM-based detection systems may have elevated false-positive rates for text written by non-native English speakers.
- The authors suggest replacing underlying LLMs with models trained on more varied and representative corpora.
A ZERO-SHOT DETECTION TASK AND SETTINGS
The paper frames zero-shot detection as distinguishing machine-generated from human-written text without training on machine-generated examples, including both accessible-source and unknown-source settings. Its analytical solution computes conditional-probability statistics token by token, with accuracy nearly matching sampling while reducing detection time further.
- Zero-shot detection uses a model without training on machine-generated text, relying on LLM capabilities to identify anomalies as markers of generated content.
- White-box detection assumes access to the source model, while black-box detection targets texts from diverse unidentified models.
- AUROC evaluates detector performance across all thresholds rather than at a single decision threshold.
- The sample mean represents cross-entropy between the sampling and scoring distributions, and token-level conditional independence enables analytical calculation.
- The sample variance can also be calculated analytically, producing nearly identical accuracy to 10,000-sample approximation while accelerating detection by about 10%.
C EXPERIMENTAL SETTINGS
The experiments evaluate generations from multiple source models, datasets, and writing domains, using local computation for smaller models and APIs for larger ones. The test set contains 150 generated samples per dataset–source-model pair, and the main comparison reports zero-shot performance in AUROC.
- Source models are ordered by parameter count, with smaller models run locally and larger models evaluated through the OpenAI API.Models below 20 billion parameters use a Tesla A100 GPU; GPT-3, ChatGPT, and GPT-4 use the OpenAI API.
- The test set contains 150 generated samples for each of XSum, WritingPrompts, and PubMedQA and each source model.
- ChatGPT and GPT-4 generate news, fiction, and technical responses at temperature 0.8 to encourage unpredictable and diverse content.
- The evaluation compares zero-shot detectors using AUROC, including Fast-DetectGPT, DetectGPT, NPR, and DNA-GPT under the stated perturbation and completion settings.
D.1 ZERO-SHOT DETECTION ON ADDITIONAL OPEN-SOURCE MODELS
Across additional open-source models and GPT-3 generations, Fast-DetectGPT generally outperforms DetectGPT and supervised baselines, with stronger gains in white-box than black-box evaluation. Performance also varies by source model and is notably better on ChatGPT than GPT-3.
- D.1 ZERO-SHOT DETECTION ON ADDITIONAL OPEN-SOURCE MODELS: 76.1% average relative improvement over DetectGPT is observed in the white-box evaluation of additional open-source models.This aligns with a 74.7% average relative improvement across five models in the main table.
- D.1 ZERO-SHOT DETECTION ON ADDITIONAL OPEN-SOURCE MODELS: 53.4% average relative improvement over DetectGPT is observed in the black-box setting, below the 74.5% average improvement in the main table.
- Fast-DetectGPT uses delegate models rather than the OpenAI API to detect GPT-3 generations in the reported comparison.
- 20% relative AUROC improvement over supervised RoBERTa and GPTZero classifiers is reported on average across three datasets.The absolute improvement is 0.0310 AUROC.
- Fast-DetectGPT performs significantly better on ChatGPT than GPT-3, with instruction-tuning and human-feedback reinforcement learning offered as possible explanations.
E ABLATION STUDY
The ablations examine sampling-model choice, normalization, and entropy within conditional probability curvature. They identify GPT-J sampling and entropy-related terms as important contributors, while normalization stabilizes token-level statistics and improves detection performance.
- Sampling Model Ablation: GPT-J sampling improves average AUROC by 0.0020, a 27% relative increase, compared with sampling from the source model.
- Normalization Ablation: Standard-deviation normalization improves DetectGPT by 0.0172 AUROC, equivalent to a 36% relative increase, and is included by default.
- Entropy Ablation: 10% of the reported 75% relative improvement is attributed to normalization, while 65% comes from the numerator log pθ(x|x) − ˜µ.
- Entropy Ablation: Token-level entropy provides a dynamic probability baseline that reduces log-likelihood variance across tokens and contexts.
- Entropy Ablation: In a ChatGPT XSum experiment, combining token log-likelihood with entropy reduces average standard deviation from 2.1893 to 1.6342.
F.1 ROBUSTNESS AGAINST DECODING STRATEGIES
Fast-DetectGPT remains more accurate than DetectGPT across top-p, top-k, and temperature-based decoding strategies in white-box and black-box settings. Lower sampling hyperparameters further improve detectability by making generated samples more deterministic.
- Experimental setup: The experiments evaluate top-k sampling, top-p sampling, and temperature sampling across five models and three datasets.The reported settings use k = 40, p = 0.96, and T = 0.8.
- Decoding strategies: Fast-DetectGPT achieves the best accuracy across top-p, top-k, and temperature sampling in the white-box setting.It outperforms DetectGPT by relative 95% on top-p, 81% on top-k, and 99% with temperature sampling.
- Decoding strategies: Fast-DetectGPT outperforms DetectGPT across all three decoding strategies in the black-box setting.The relative gains are 92% for top-p, 80% for top-k, and 98% for temperature sampling.
- Hyperparameter effects: Reducing p, k, and T increases AUROCs by making generated samples more deterministic and easier to detect.Additional experiments use p = 0.90, k = 30, and T = 0.6.