Abstract
As Large Language Models (LLMs) like GPT-4 and Claude 3 become increasingly sophisticated, distinguishing machine-generated text from human writing has become a critical challenge for digital integrity. Traditional detection methods often rely on final-layer semantic features or surface-level linguistic patterns, both of which are susceptible to domain shifts and adversarial attacks. This paper introduces Text Fluoroscopy, a novel detection framework that extracts "intrinsic features" from the middle layers of a pre-trained language model. By dynamically identifying the layer where the compositional process is most distinct from raw input and final semantics, Text Fluoroscopy achieves state-of-the-art accuracy and exceptional robustness against paraphrasing and back-translation.
Introduction
The rapid advancement of LLMs has brought significant risks, including automated disinformation campaigns and academic dishonesty. Consequently, there is an urgent need for reliable AI text detectors that can operate in "black-box" scenarios where the source model is unknown.
Previous detection methods generally suffer from two primary limitations:
- Semantic Overfitting: Methods using the final layer of a model (e.g., BERT) capture abstract semantic meaning. Since human and AI text on the same topic share similar semantics, these detectors often fail to generalize across different domains.
- Linguistic Fragility: Methods relying on word frequencies or part-of-speech tags are easily bypassed by simple paraphrase attacks or prompt engineering.
Text Fluoroscopy addresses these issues by looking inside the hidden states of an encoder to find a more stable "fingerprint" of machine generation.
Methodology
The core innovation of Text Fluoroscopy is the shift from semantic or linguistic features to intrinsic features found in the middle layers of a language model. The authors utilize gte-Qwen1.5-7B-instruct as their primary encoder, arguing that while early layers capture word-level info and late layers capture sentence-level semantics, the intermediate layers capture the compositional process—the unique way an LLM structures its output.
To extract these features, the algorithm follows a dynamic selection process:
- Forward Pass: The text is passed through the encoder.
- Distribution Mapping: The model's vocabulary prediction head is applied to the hidden states of every layer. This is possible due to the smooth transitions created by residual connections.
- KL Divergence Calculation: The system calculates the Kullback-Leibler (KL) divergence between each middle layer's probability distribution and the distributions of the first and last layers.
- Layer Selection: It selects the layer $M$ that maximizes this combined KL divergence, identifying the representation most distinct from both raw input and final abstract semantics.
- Classification: Features from layer $M$ are fed into a 3-layer MLP classifier trained to distinguish human from AI text.
Experimental Setup
To test the generalization of the model, the authors trained Text Fluoroscopy on a minimal dataset (the first 200 entries of the HC3 corpus) and evaluated it on entirely different domains and generators:
- Evaluation Domains: Xsum (News), WritingPrompts (Stories), and PubMedQA (Biomedical research).
- Generators: ChatGPT (gpt-3.5-turbo), GPT-4, and Claude 3 (Opus).
- Adversarial Attacks: The model was tested against DIPPER (paraphrasing) and DeepL (back-translation).
Results and Discussion
Text Fluoroscopy demonstrated superior performance across all test categories, significantly outperforming established baselines like RoBERTa-based detectors and zero-shot methods like Fast-DetectGPT.
Key Findings
- Cross-Domain Generalization: The method achieved an average AUROC of 96.73% for ChatGPT, 97.94% for GPT-4, and 98.71% for Claude 3. As shown in the results table, it maintained high performance even in specialized domains like PubMedQA where other models struggled.
- The "Sweet Spot" Advantage: By focusing on the middle layers, the detector captures compositional patterns that are harder for LLMs to mimic or for paraphrasers to erase.
- Extreme Robustness: In adversarial testing, Text Fluoroscopy maintained a near-perfect 99.96% AUROC against DIPPER paraphrase attacks on the Xsum dataset, while competing methods like NPR saw their accuracy drop significantly (from 78% to 56%).
Conclusion
Text Fluoroscopy represents a significant step forward in AI text detection by leveraging the internal mechanics of language models rather than their final outputs. While the dynamic calculation of KL divergence introduces some computational overhead (~0.5s per text), the authors found that hardcoding the detector to use a specific middle layer (e.g., the 30th layer) can speed up inference by 5x with negligible loss in accuracy. Future work will focus on optimizing these fixed-layer extractions to provide a fast, robust, and highly accurate tool for identifying machine-generated content.
Summary updated