Abstract
Artificial Text Detection (ATD) systems frequently struggle with out-of-distribution (OOD) generalization, failing when faced with novel generators or domains. This research proposes that "less is more": by identifying and removing specific linear subspaces within Transformer-based embeddings—such as certain attention heads or embedding coordinates—detectors can be forced to ignore spurious, dataset-specific features. We evaluate three strategies: coordinate-based removal, head-wise pruning, and concept erasure. Our results demonstrate that these restricted embedding techniques significantly improve robustness, with performance gains of up to 14% in OOD scenarios, particularly by filtering out distracting global syntactic signatures.
Introduction
The proliferation of large language models (LLMs) has made the reliable detection of machine-generated text a critical task. However, current Artificial Text Detection (ATD) models exhibit a "brittleness" problem: while they achieve near-perfect accuracy on in-domain data, their performance plummets when encountering text from a different AI model or a new subject matter. This failure occurs because classifiers often "lock into" spurious features—such as a specific model's idiosyncratic punctuation or a domain's typical sentence length—rather than learning a universal "statistical signature" of AI generation.
Methods
To address this brittleness, we investigated the geometry of Transformer-based encoders (e.g., BERT, RoBERTa) to identify and remove harmful information. We proposed three primary methods for restricting embeddings:
- Coordinate-based Removal: A greedy search identifies specific dimensions in the embedding vector that negatively impact OOD performance. These dimensions are then nullified.
- Head-wise Pruning: Entire layers of attention heads are removed. Interestingly, pruning earlier layers—which typically capture surface-level linguistic features—often enhances generalization.
- Concept Erasure (LEACE): Using the LEACE technique, we "blind" the classifier to specific linguistic concepts like sentence length, tree depth, or tense. This allows us to isolate and remove features that act as distracting shortcuts.
Datasets and Evaluation
Our study utilized two benchmarks:
- SemEval-2024 Task 8 (M4): A diverse dataset spanning five domains (Wikipedia, Reddit, WikiHow, PeerRead, arXiv) and five generators (GPT-3.5, Cohere, Bloomz, etc.).
- GPT-3D: A new dataset extending previous work by including text generated by GPT-4o across Wikipedia, Reddit, and StackExchange, providing a rigorous test against frontier models.
Key Insights and Results
The "restricted embedding" approach yielded substantial gains in robustness across multiple architectures. For RoBERTa, head-wise and coordinate-based removal increased mean OOD scores by up to 9%, while BERT saw improvements as high as 14%.
A significant finding was that erasing "global syntax" (e.g., syntactic tree depth) improved cross-domain transfer by up to 13%. This suggests that while LLMs have distinct syntactic fingerprints, these fingerprints are highly domain-dependent and confuse general-purpose detectors. Conversely, local grammatical categories like tense or subject number were found to be consistent across generators and did not hinder robustness.
We also observed that these methods are more effective for encoder-based models than decoder-based ones (like Phi-2), likely due to the "triangular attention mask" in decoders which complicates feature disentanglement.
Discussion and Limitations
While restricted embeddings offer a path toward more robust detection, challenges remain. GPT-4 generations proved uniquely difficult to detect, sometimes causing classifiers to perform below random chance, possibly due to sophisticated generation strategies or internal watermarking. Furthermore, this study focused on "clean" AI text. Future research must address real-world scenarios involving post-processing, human editing, and adversarial paraphrasing to ensure long-term viability in the evolving LLM landscape.
Summary updated