Robust AI-Generated Text Detection by Restricted Embeddings

Kristian Kuznetsov, Eduard Tulchinskii, Laida Kushnareva, German Magai, Serguei Barannikov, Sergey I. Nikolenko, Irina Piontkovskaya

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.

Figure 1: Performance heatmaps illustrating the drop in accuracy during cross-domain and cross-model testing.

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:

  1. Coordinate-based Removal: A greedy search identifies specific dimensions in the embedding vector that negatively impact OOD performance. These dimensions are then nullified.
  2. Head-wise Pruning: Entire layers of attention heads are removed. Interestingly, pruning earlier layers—which typically capture surface-level linguistic features—often enhances generalization.
  3. 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%.

Figure 4: Comparison of baseline RoBERTa performance against various restricted embedding strategies, showing improved OOD scores.

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

BibTeX
@inproceedings{kuznetsov2024robust,
  author = {Kristian Kuznetsov and Eduard Tulchinskii and Laida Kushnareva and German Magai and Serguei Barannikov and Sergey I. Nikolenko and Irina Piontkovskaya},
  title = {{Robust AI-Generated Text Detection by Restricted Embeddings}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  doi = {10.18653/v1/2024.findings-emnlp.992},
}
Figure