Abstract
Large language models (LLMs) have reached human-like proficiency in generating diverse textual content, underscoring the necessity for effective fake text detection to avoid potential risks such as fake news in social media. Previous research has mostly tested single models on in-distribution datasets, limiting our understanding of how these models perform on different types of data for LLM-generated text detection tasks. We researched this by testing five specialized transformer-based models on both in-distribution and out-of-distribution datasets to better assess their performance and generalizability. Our results revealed that single transformer-based classifiers achieved decent performance on in-distribution datasets but limited generalization ability on out-of-distribution datasets. To improve this, we combined the individual classifier models using adaptive ensemble algorithms, which improved the average accuracy significantly from 91.8% to 99.2% on an in-distribution test set and from 62.9% to 72.5% on an out-of-distribution test set. The results indicate the effectiveness, good generalization ability, and great potential of adaptive ensemble algorithms in LLM-generated text detection.
Introduction
As large language models (LLMs) like ChatGPT and Llama become increasingly proficient at mimicking human prose, the line between human-authored and machine-generated content has blurred. This evolution presents significant challenges for academic integrity, copyright enforcement, and the mitigation of automated fake news. While various AI detection tools have been developed, they frequently struggle with generalization; a model trained on a specific corpus often fails when applied to novel domains or different generative architectures.
This research addresses the "brittleness" of single-model detectors by proposing an ensemble-based approach. By leveraging the diverse strengths of multiple transformer architectures and aggregating their outputs through adaptive meta-learners, we demonstrate a significant increase in detection robustness across both familiar and unfamiliar datasets.
Methodology
The proposed detection framework utilizes a two-stage architecture designed to maximize diversity and adaptability.
1. Individual Classifier Training
Five distinct transformer-based models were selected for their architectural variety, ensuring that the ensemble could benefit from different feature extraction methods:
- DistilBERT & DeBERTaV3: Efficient and high-performing variants of the BERT architecture.
- FNet: A model that replaces standard self-attention with Fourier transforms to enhance processing speed and capture different structural patterns.
- Albert & XLMRoberta: Models optimized for parameter efficiency and cross-lingual robustness, respectively.
Each model was fine-tuned on a primary dataset to establish a baseline for individual performance.
2. Adaptive Ensemble Algorithms
To combine these classifiers, the study compared two distinct strategies:
- Non-adaptive (Hard Voting): A simple majority-rule system where each model contributes an equal vote.
- Adaptive Ensembles: These methods employ a "meta-learner" to dynamically weight the outputs of the base classifiers. The researchers evaluated three meta-learning architectures: a Neural Network (utilizing two ReLU layers), Random Forest, and Gradient Boosting Decision Trees (GBDT). By freezing the base transformers and training only the ensemble layer, the system learns to prioritize the most reliable models for specific textual contexts.
Experimental Setup
The models were evaluated using two primary benchmarks to test both internal consistency and external generalization:
- In-Distribution (ID): The DAIGT Dataset served as the training and ID testing set. It contains a 2:1 ratio of human-written to LLM-generated text, including outputs from ChatGPT and Llama-70b.
- Out-of-Distribution (OOD): The Deepfake Dataset was used to test generalization. This dataset differs significantly from the training data, featuring shorter text lengths, different parts-of-speech distributions, and diverse domains such as legal documents, scientific texts, and movie reviews.
Results and Discussion
Performance on In-Distribution Data
On the DAIGT dataset, single transformer models performed well, with an average accuracy of 91.8%. However, the introduction of adaptive ensembles elevated this performance to near-perfection, reaching 99.2% accuracy. This suggests that even when data is familiar, an ensemble can effectively eliminate the residual errors of individual models.
Generalization to Out-of-Distribution Data
The most significant findings appeared in the OOD testing. Single models showed a dramatic performance drop, averaging only 62.9% accuracy. Some high-performing ID models, such as DeBERTaV3, saw their accuracy plummet from 97.4% to 61.6% when faced with the Deepfake dataset.
In contrast, the adaptive ensembles demonstrated superior resilience. The Neural Network ensemble achieved an OOD accuracy of 73.6%. While a performance gap between ID and OOD data remains, the ensemble approach significantly narrowed it, proving that meta-learners can better navigate the structural differences between human and machine writing across varied domains.
Conclusion
This research highlights that while single transformer models are powerful, they are often too specialized to handle the diversity of real-world LLM outputs. Adaptive ensembles offer a robust alternative, significantly improving both peak accuracy and cross-domain generalization. Future work will focus on expanding the diversity of training data and exploring adversarial training techniques to further bridge the gap in out-of-distribution detection, moving toward a more reliable solution for identifying LLM-generated content in the wild.
Summary updated