Table of Contents
Fetching ...

TempTest: Local Normalization Distortion and the Detection of Machine-generated Text

Tom Kempton, Stuart Burrell, Connor Cheverall

TL;DR

TempTest introduces TempNorm, a model-agnostic zero-shot detector for machine-generated text that exploits local normalization distortion caused by temperature sampling. Grounded in Bayesian reasoning and ergodic theory, it defines a TempTest score $\text{TempTest}(\underline w)=\frac{1}{T}\Big(\log \epsilon_{\tau}(\underline w)-(\frac{1}{\tau}-1)\log P(\underline w)\Big)$, with a linear decision boundary of slope $(1/\tau)-1$ to separate human and machine text. Across white, gray, and black-box settings on multiple datasets and model families, TempTest achieves comparable or superior AUROC performance, particularly for short passages, and demonstrates robustness to temperature mis-specification. The work also extends to top-k detection analogues and evaluates biases toward non-native speakers, highlighting practical applicability and avenues for future enhancement, including non-English data and top-p variants.

Abstract

Existing methods for the zero-shot detection of machine-generated text are dominated by three statistical quantities: log-likelihood, log-rank, and entropy. As language models mimic the distribution of human text ever closer, this will limit our ability to build effective detection algorithms. To combat this, we introduce a method for detecting machine-generated text that is entirely agnostic of the generating language model. This is achieved by targeting a defect in the way that decoding strategies, such as temperature or top-k sampling, normalize conditional probability measures. This method can be rigorously theoretically justified, is easily explainable, and is conceptually distinct from existing methods for detecting machine-generated text. We evaluate our detector in the white and black box settings across various language models, datasets, and passage lengths. We also study the effect of paraphrasing attacks on our detector and the extent to which it is biased against non-native speakers. In each of these settings, the performance of our test is at least comparable to that of other state-of-the-art text detectors, and in some cases, we strongly outperform these baselines.

TempTest: Local Normalization Distortion and the Detection of Machine-generated Text

TL;DR

TempTest introduces TempNorm, a model-agnostic zero-shot detector for machine-generated text that exploits local normalization distortion caused by temperature sampling. Grounded in Bayesian reasoning and ergodic theory, it defines a TempTest score , with a linear decision boundary of slope to separate human and machine text. Across white, gray, and black-box settings on multiple datasets and model families, TempTest achieves comparable or superior AUROC performance, particularly for short passages, and demonstrates robustness to temperature mis-specification. The work also extends to top-k detection analogues and evaluates biases toward non-native speakers, highlighting practical applicability and avenues for future enhancement, including non-English data and top-p variants.

Abstract

Existing methods for the zero-shot detection of machine-generated text are dominated by three statistical quantities: log-likelihood, log-rank, and entropy. As language models mimic the distribution of human text ever closer, this will limit our ability to build effective detection algorithms. To combat this, we introduce a method for detecting machine-generated text that is entirely agnostic of the generating language model. This is achieved by targeting a defect in the way that decoding strategies, such as temperature or top-k sampling, normalize conditional probability measures. This method can be rigorously theoretically justified, is easily explainable, and is conceptually distinct from existing methods for detecting machine-generated text. We evaluate our detector in the white and black box settings across various language models, datasets, and passage lengths. We also study the effect of paraphrasing attacks on our detector and the extent to which it is biased against non-native speakers. In each of these settings, the performance of our test is at least comparable to that of other state-of-the-art text detectors, and in some cases, we strongly outperform these baselines.

Paper Structure

This paper contains 36 sections, 20 equations, 8 figures, 4 tables.

Figures (8)

  • Figure 1: Relationship Between Per-token Log-TempNorm and Per-token Log-likelihood. Observe that per-token log-likelihood alone does a poor job of distinguishing between these sets of 300-token human-written and Llama 3.1 temperature sampled text ($\tau=0.8$), as indicated by overlap in the orthogonal projection onto the $x$-axis. Adding a second coordinate displaying per-token log-TempNorm allows for linear separation of the texts.
  • Figure 2: Performance Across Scoring Temperatures. TempTest is robust to the particular choice of temperature used for scoring, even if it is significantly different from the ground-truth temperature used for generation. As expected, for $\tau=1$ the AUROC drops to $0.5$, as this case equivalent to pure-sampling. Meta Llama 3.1-8B is used for generation and scoring, and the ground-truth generation temperature is $0.8$.
  • Figure 3: Performance On GPT-3.5 Turbo And GPT-4 Generated Data. TempTest obtains comparable or superior performance to Fast-DetectGPT across a range of passage lengths in an illustrative black-box setting when using GPT-3.5 Turbo or GPT-4 as the generation model. Two scoring models were considered here: Meta Llama 3.1-8B and GPT-Neo 2.7b. A temperature of $0.8$ was used for generation and scoring. Results are averaged over Writing, XSum, and PubMedQA completions.
  • Figure 4: Performance For Varying Context Lengths. AUROCs averaged across all 3 datasets and 5 models used in Table \ref{['tab:whitebox']} at input text sizes ranging from $25$ to $100$ tokens.
  • Figure 5: Robustness Of TempTest Under Paraphrasing. TempTest is less susceptible to paraphrasing attacks than the previous art, Fast-DetectGPT, over a range of input text sizes. Reported AUROC values are the average over datasets Writing, XSum, and SQuAD.
  • ...and 3 more figures

Theorems & Definitions (2)

  • Definition 4.1
  • Definition 4.2