SPADE: Soft Prompts for Ai-text DEtection

Alex Jiang, Didier Schwab, Chuyuan LiarXiv 2026 · arXiv

TL;DR

SPADE (Soft Prompts for Ai-text DEtection) is a novel framework that detects AI-generated text by learning class-specific "soft prompts" that model the latent generative context of AI vs. human writing. By using Pointwise Mutual Information (PMI) to measure how well these learned prompts explain a candidate text, SPADE achieves state-of-the-art generalization across unseen datasets and model families while remaining computationally efficient.

What Problem Does This Paper Address?

As Large Language Models (LLMs) become ubiquitous, distinguishing between human-written and AI-generated text has become a critical but increasingly difficult task. Existing detectors generally fall into two camps:

  1. Supervised detectors: These often overfit to the specific domains or prompts present in their training data, failing when they encounter "out-of-distribution" (OOD) text.
  2. Zero-shot detectors: These rely on statistical properties like raw text likelihood. However, as shown in the paper, raw likelihood is a noisy signal because it doesn't account for the prompt that triggered the generation.

The authors argue that LLM generation is inherently conditioned on a prompt, yet most detectors ignore this generative context. While some "regeneration-based" methods try to account for this by asking an LLM to rewrite the text and comparing the results, they are often slow and rely on manually crafted "hard" prompts.

Methods

SPADE introduces a way to capture the "influence" of a prompt using Soft Prompting. Instead of using fixed text, the authors learn two continuous vectors (soft prompts): $c_{ai}$ to represent the latent context of AI generation, and $c_h$ to represent the implicit context of human writing.

The Core Metric: PMI

The framework relies on Pointwise Mutual Information (PMI), defined as: $$PMI(x, c) = \log q(x|c) - \log q(x)$$ This measures how much a context $c$ helps a model $q$ explain a text $x$. By subtracting the raw likelihood $\log q(x)$, the metric removes the "intrinsic" complexity of the text and focuses solely on the influence of the prompt. As seen in Figure 1, PMI provides a much clearer separation between classes than raw likelihood.

Figure 1: Histograms of the negative log-likelihood (NLL) (above) and PMI (below) using a generic instruc- tion prompt "Make this text more formal and profes- sional:" across three backbones (Qwen, LLaMA, Fal- con) on MIRAGE-DIG (Fu et al., 2025) test split. The prompt’s influence PMI is a better discriminative signal than NLL.

Training and Inference

  • Training: The soft prompts are trained using a contrastive hinge loss. This forces the AI prompt to explain AI-generated text better than the human prompt (and vice versa) by at least a specific margin. The backbone LLM remains frozen throughout this process.
  • Inference: Detection is performed using a Log-Likelihood Ratio (LLR) test. The system compares the PMI of the text under both learned prompts. If the AI prompt "explains" the text better than the human prompt, it is classified as AI.
Overview of SPADE Training and Inference

Datasets

The authors emphasize robustness across different distributions:

  • Training: MIRAGE, a dataset containing human and AI texts from 9 model families across 5 domains.
  • Evaluation (OOD): RAID (8 domains, 11 models) and EvoBench (5 domains, 6 model families). These are used to test how well the detector transfers to entirely unseen data.
  • Cross-Lingual: DetectRL-X, used to evaluate performance across 8 different languages.

Key Insights and Ideas

  • Context is the Missing Link: The fundamental "aha" moment is that AI text isn't just statistically different; it is conditioned differently. By learning a representative "AI context," we can better identify the fingerprints left by the generation process.
  • Efficiency via Soft Prompts: Because SPADE only tunes a small number of prompt parameters and keeps the backbone frozen, it is much lighter than full fine-tuning.
  • PMI as a Normalizer: Using PMI instead of raw likelihood acts as a crucial normalization step, preventing the detector from being fooled by naturally "high-likelihood" human text or "low-likelihood" AI text.

Key Results

SPADE achieves significant performance gains over both zero-shot and supervised baselines:

  • Superior Generalization: On OOD benchmarks, SPADE outperformed supervised baselines by 4.8–25.1 AUC on EvoBench and 8.2–26.4 AUC on RAID.
  • Robustness to Length: Unlike many detectors that fail on short snippets, SPADE maintains high accuracy (98.2 AUC) even on texts as short as 75 tokens.
  • Speed: SPADE is approximately 85x faster than regeneration-based methods like RAIDAR because it only requires a single forward pass with two prompts.
  • Backbone Scaling: Performance generally improves with the quality of the backbone LLM (e.g., Llama-3 or Qwen-3), suggesting the method will scale with future model improvements.
Figure 4: Impact of the backbone on SPADE’s perfor- mance, averaged over EvoBench and RAID.

Limitations and Future Work

  • Base Models: The method is currently most effective for instruction-tuned models. Performance drops when trying to detect text from "base" models that haven't undergone instruction finetuning.
  • Adversarial Attacks: While robust to many attacks (like synonym substitution), SPADE is still vulnerable to specific "evasion" techniques like the insertion of zero-width spaces.
  • Model Attribution: The authors suggest that the class-specific prompt approach could potentially be extended from binary detection (AI vs. Human) to model attribution (identifying which AI wrote the text).

Summary updated

Abstract

The easy access to Large Language Models (LLMs) has made AI-generated texts on the web increasingly ubiquitous, making AI-text detection a crucial task. Prompts greatly influence the generation process, but existing detectors focus solely on the generated texts --- supervised methods learn from labeled texts only, and zero-shot methods rely on the text's probability distributions --- ignoring the underlying generation process, which limits their robustness in open-world scenarios. We introduce SPADE: Soft Prompts for Ai-text DEtection, a novel framework for detecting AI-generated text that transfers better across datasets. Specifically, we measure the prompt's influence and use it as a discriminative signal. We characterize the prompt's influence by introducing a Pointwise Mutual Information (PMI) term that captures how much a prompt explains a text. Based on this quantity, SPADE trains one soft prompt per class to amplify the separation, and predicts the class whose prompt best explains the candidate text. Extensive experiments on several benchmarks against various detectors demonstrate the robustness and effectiveness of our method, achieving state-of-the-art (SOTA) performance on out-of-distribution (OOD) datasets.
BibTeX
@misc{jiang2026spade,
  author = {Alex Jiang and Didier Schwab and Chuyuan Li},
  title = {{SPADE: Soft Prompts for Ai-text DEtection}},
  year = {2026},
  eprint = {2611.16929},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.16929},
}
Figure