Hitting a Moving Target: Test-Time Adaptation for AI Text Detection under Continual Distribution Shift

Kevin Ren, Manish Raghavan, Nikhil Garg

TL;DR

Current AI text detectors are highly brittle, failing when faced with new LLMs, clever "humanizer" tools, or natural shifts in human writing over time. This paper introduces a Test-Time Adaptation (TTA) framework that leverages the statistical homogeneity of text cohorts at inference time to dynamically update detection boundaries without needing new labeled data. This approach drastically improves robustness, boosting the detection of adversarially altered AI text from 24.1% (using a state-of-the-art commercial baseline) to 90.5%.

What Problem Does This Paper Address?

Supervised AI text detectors assume that post-deployment test data will perfectly match their training distributions. In the real world, this assumption is shattered by three continuous, evolving distribution shifts:

  1. Adversarial humanization: Users employ specialized tools or prompting loops to intentionally alter AI text style to evade detection.
  2. New LLM releases: Fresh models with entirely novel, unseen writing styles are constantly deployed.
  3. Temporal drift: Human writing styles naturally evolve over time, causing older training sets of human text to become obsolete.

Standard retraining pipelines are too slow and expensive to counter these shifts because they require continuous data collection and manual labeling. Furthermore, existing detectors treat every incoming text sample independently, completely ignoring a powerful statistical signal: inference-time homogeneity (the tendency of a cohort of texts generated by the same LLM or modified by the same humanizer to share latent algorithmic patterns).

Methods

The authors propose Test-Time Adaptation (TTA) for AI text detection. Instead of keeping the detector frozen after deployment, the model dynamically adjusts its decision boundary using a batch or cohort of unlabeled samples observed during inference.

The core components of their method include:

  • Positive-Unlabeled (PU) and Positive-Negative-Unlabeled (PNU) Learning: The model treats verified human text (or known baseline AI text) as the labeled class, while treating the incoming test cohort as an unlabeled mixture of human and shifted AI text.
  • The (TED)$^n$ Algorithm: A semi-supervised learning method used to re-estimate the classification boundary on high-dimensional text embeddings without explicit target labels.
  • Best-Bin Estimation (BBE): An algorithm integrated into the pipeline to accurately estimate the overall prevalence of AI-generated text within the test cohort.

By adapting at test time, the detector effectively gains the "last move" advantage in the cat-and-mouse game against adversarial evaders.

Figure 1: Comparing AI text detection with supervised learning (top) and test-time adaptation with semi-supervised learning (bottom). With supervised detection: a detector is trained on labeled human and AI text, released, and can fail under distribution shift. With test-time adaptation: the detector re-estimates its boundary using submitted texts at inference time and therefore can adapt.

Datasets

The framework was rigorously evaluated across two primary data sources:

  • Cornell arXiv Dataset: Approximately 60,000 paper abstracts spanning 2010–2020. This dataset was used to simulate natural temporal drift in human writing and served as the source text for generating synthetic AI "mirrors."
  • RAID Benchmark: A massive, pre-existing benchmark containing over 6 million human and AI-generated texts. It features multiple domains, 11 different LLMs, and various adversarial perturbations (e.g., homoglyph attacks, synonym swaps), providing a robust testbed for out-of-distribution generalization.

Key Insights and Ideas

  • Flipping the Strategic Disadvantage: In standard text detection, the adversary has the upper hand because they can iteratively query a fixed API until their text passes. TTA flips this dynamic; the detector updates its boundary after receiving the batch of strategic responses.
  • Algorithmic Monoculture as a Defense: While the repetitive, homogeneous nature of LLM text is often criticized, TTA turns this property into a feature. Because an LLM or a humanizer applies consistent stylistic rules across a cohort, the shifted texts naturally cluster together in embedding space, making them identifiable without explicit labels.
  • The Illusion of Supervised Perfection: Deployed commercial models like Pangram boast near-perfect in-distribution accuracy but degrade catastrophically when exposed to minor style modifications or newer model architectures.

Key Results

  • Defeating Optimized Humanizers: Against an automated agent optimized to evade detection, the commercial detector Pangram's recall plummeted to 24.1%. Meanwhile, the proposed PU+TTA approach maintained a robust 90.5% detection rate.
  • Adapting to New Models: When evaluating a newly released model (simulated via GPT 5.4), Pangram's detection rate dropped to 34.0%. TTA methods adapted seamlessly, restoring near-perfect detection by analyzing the unlabeled cohort.
  • Data Efficiency: The TTA framework requires surprisingly little unlabeled data to adapt. As shown in the experiments, the model's accuracy against adversarial text scales rapidly with only a few thousand unlabeled sentences.
AI Recall curves showing that only a small amount of unlabeled adversarial data is required for TTA to achieve high accuracy.
  • Correcting Human Drift: When trained on human text from 2010, standard supervised models mistakenly flagged 15.1% of human sentences from 2020 as AI-generated due to natural language drift. TTA stabilized the human baseline, preventing false positives over a decade of language evolution.

Limitations and Future Work

  • Batch Size Dependency: TTA inherently relies on receiving a cohort or batch of text samples at inference time. Its performance on isolated, single-sample queries (e.g., a teacher checking a single essay) remains a challenge.
  • Vulnerability to Data Poisoning: Because the model updates its decision boundary based on unlabeled incoming data, sophisticated adversaries could theoretically inject "poisoned" text samples to intentionally distort the detector's boundary.
  • Overlapping Shifts: The paper primarily evaluates adversarial, model, and temporal shifts in isolation. Future work is needed to explore how TTA handles multiple, simultaneous distribution shifts.

Summary updated

Abstract

Deployed approaches for AI text detection often rely on training-time access to labeled datasets of both human-written and AI-generated text. This approach is vulnerable to three types of distribution shifts that occur continually post-deployment, and for which labeled data is often unavailable: adversarial humanization, new LLMs being released, and temporal drift in human writing. Simultaneously, existing approaches do not leverage a key signal of LLM usage: inference-time homogeneity. We propose a test-time adaptation (TTA) approach, using semi-supervised learning, that adapts to distribution shifts by leveraging homogeneity among unlabeled samples observed at inference time. Empirically, we find that state-of-the-art supervised detectors systematically fail when they encounter distribution shifts in AI-generated and human writing, both adversarial and natural, while test-time adaptation with semi-supervised learning is largely robust; e.g., the commercial model Pangram detects just 24.1% of our adversarial AI-generated text, compared to 90.5% for our test-time approach. We establish that test-time adaptation is a promising framework for AI text detection in the wild. We publicly release our code (which includes code for model training, evaluation, and plots) at https://github.com/kkr36/llm_detection.
BibTeX
@misc{ren2026hitting,
  author = {Kevin Ren and Manish Raghavan and Nikhil Garg},
  title = {{Hitting a Moving Target: Test-Time Adaptation for AI Text Detection under Continual Distribution Shift}},
  year = {2026},
  eprint = {2606.25152},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2606.25152},
}
Figure