Abstract
The advent of instruction-tuned language models that convincingly mimic human writing poses a significant risk of abuse. However, such abuse may be counteracted with the ability to detect whether a piece of text was composed by a language model rather than a human author. Some previous approaches to this problem have relied on supervised methods by training on corpora of confirmed human- and machine-written documents. Unfortunately, model under-specification poses an unavoidable challenge for neural network-based detectors, making them brittle in the face of data shifts, such as the release of newer language models producing still more fluent text than the models used to train the detectors. Other approaches require access to the models that may have generated a document in question, which is often impractical. In light of these challenges, we pursue a fundamentally different approach not relying on samples from language models of concern at training time. Instead, we propose to leverage representations of writing style estimated from human-authored text. Indeed, we find that features effective at distinguishing among human authors are also effective at distinguishing human from machine authors, including state-of-the-art large language models like Llama-2, ChatGPT, and GPT-4. Furthermore, given a handful of examples composed by each of several specific language models of interest, our approach affords the ability to predict which model generated a given document.
Introduction
As Large Language Models (LLMs) like GPT-4 and Llama-3 become increasingly fluent, the line between human and machine authorship has blurred. Traditional detection methods—often relying on supervised classifiers trained on specific datasets—struggle to maintain accuracy when faced with new models or shifts in topic. This research, originally presented at ICLR 2024, proposes a shift in perspective: rather than identifying the content-based "tells" of a specific AI, we should focus on the underlying stylistic fingerprints that distinguish human writing from machine-generated text.
The Challenge of Distribution Shift
Most current AI detectors are supervised, meaning they are trained on a fixed dataset of human versus machine text. These models are notoriously brittle; when a new LLM is released, the detector’s performance often plummets because it has learned the specific patterns of older models rather than a generalizable definition of "machine-ness." Furthermore, methods like watermarking require cooperation from model providers, which is ineffective against open-source models or adversarial actors.
To address this, we require a detector that is robust to new models, agnostic to the subject matter, and capable of operating with minimal examples of a target model's output.
Methodology: Universal Authorship Representations
The core of this approach is the Universal Authorship Representation (UAR). Instead of training a binary classifier, the system utilizes a model (based on RoBERTa) trained via contrastive learning on massive corpora of human text, such as Reddit comments from 5 million different authors.
Style Embedding and Few-Shot Detection
- Style Space: The model maps documents into a high-dimensional "style space," where documents by the same author are clustered together and those by different authors are separated.
- Support Sets: To detect a specific LLM (e.g., ChatGPT), the user provides a small "support set" of known machine-generated documents.
- Inference: When an unknown document is analyzed, the system calculates its style embedding and measures the cosine similarity to the support set. If the style aligns more closely with the machine's signature than with typical human variations, it is flagged as machine-generated.
Experimental Evaluation
The researchers tested this method across several distinct datasets to evaluate generalization:
- AAC (Amply Available and Cheap): Text from older models like GPT-2 and OPT.
- LWD (Likely Want to Detect): A new dataset featuring state-of-the-art models including Llama-2, ChatGPT, and GPT-4.
- M4: A multi-domain benchmark covering ArXiv abstracts, Wikipedia, and WikiHow.
Performance was measured using pAUC (partial Area Under the ROC Curve), focusing on a false-alarm rate below 1%. This metric is critical for real-world applications like academic integrity, where false accusations must be minimized.
Key Insights
Style as an Invariant
The most significant finding is that features used to distinguish between different human authors are also highly effective at distinguishing humans from machines. Even as LLMs become more sophisticated, they retain a consistent stylistic signature that differs from the vast diversity of human writing.
Robustness to Paraphrasing and Domain
Because the UAR focuses on high-level stylistic representations rather than specific vocabulary, it remains robust against paraphrasing attacks (e.g., using DIPPER). Furthermore, the model proved domain-agnostic; style representations learned on Reddit comments successfully transferred to Amazon reviews and Wikipedia entries, proving that "style" transcends specific topics.
Model Identification
Beyond simple detection, the approach allows for model identification. Because different LLMs possess distinct stylistic signatures, the system can often predict which specific model generated a given document given a few reference samples.
Results and Limitations
On the LWD dataset, the UAR-based few-shot method achieved a pAUC of 0.886 with only 5 examples, rising to 0.967 with 10 examples. This consistently outperformed standard few-shot algorithms (like MAML) and zero-shot detectors (like LogRank).
However, some limitations remain:
- Language: The current study is limited to English. While the methodology is language-agnostic, it requires large-scale human data for other languages to build effective style representations.
- Text Length: Style is difficult to extract from very short snippets. The system is most reliable for documents exceeding 128 tokens.
- Support Set Requirement: Unlike zero-shot methods, this approach requires a handful of examples from the target model, which may be a hurdle for private or custom-tuned LLMs.
Conclusion
By leveraging the stylistic nuances of millions of human authors, this research provides a robust framework for detecting even the most advanced machine-generated text. This shift from content-based detection to style-based representation offers a more sustainable path forward in the ongoing effort to ensure transparency in digital communication. The code and data for this project are available at https://github.com/LLNL/LUAR/tree/main/fewshot_iclr2024.
Summary updated