Weighted Layer Averaging RoBERTa for Black-Box Machine-Generated Text Detection

Ayan Datta, Aryan Chandramania, Radhika MamidiNAACL 2024

TL;DR

This paper tackles the growing challenge of detecting machine-generated text by proposing a novel approach that leverages weighted averaging of RoBERTa's internal layers. By combining information from different linguistic levels captured by these layers, the authors aim to improve detection accuracy, especially for texts generated by diverse models and across various domains.

What Problem Does This Paper Address?

The rapid advancement of Large Language Models (LLMs) has led to an explosion of machine-generated text across numerous fields, from legal documents to academic submissions. This proliferation necessitates robust methods for distinguishing between human- and machine-authored content. Existing approaches often rely on the final output layer of models like RoBERTa, potentially overlooking crucial linguistic nuances captured in earlier layers. This paper addresses the gap by exploring how to effectively utilize the rich, multi-level linguistic information encoded within the hidden states of a pre-trained language model for more accurate machine-generated text detection.

Methods

The core of the proposed method involves Weighted Layer Averaging (WLA) applied to the RoBERTa-base model. Instead of solely using the [CLS] token's representation from the final layer, the authors propose to take a weighted sum of the hidden states from all layers of RoBERTa. Each layer's contribution to the final representation is determined by a weight ($\lambda_j$), which is learned jointly with the classification task. This approach is inspired by models like ELMo, which demonstrated the value of combining representations from different layers.

To further enhance efficiency and prevent catastrophic forgetting during fine-tuning, the authors employ Parameter Efficient Tuning with AdaLoRa. AdaLoRA, an extension of LoRA (Low-Rank Adaptation), dynamically adjusts the ranks of the low-rank decomposition matrices injected into the Transformer architecture. This allows for more flexible adaptation to the specific task while significantly reducing the number of trainable parameters compared to full fine-tuning.

Datasets

The experiments were conducted on data provided for SemEval-2024 Task 8, which is an extension of the M4 Dataset. This dataset is described as a multi-generator, multi-domain, and multi-lingual corpus for machine-generated text detection. The data for subtasks A (monolingual) and B (multi-class classification) consists of source, model, label (Human/Machine), and the text itself. The authors mention resplitting the provided training and development datasets to ensure a uniform distribution across generators and domains, using an 80-20 split for training and development.

Key Insights and Ideas

  • Layer-wise information is crucial: The paper hypothesizes that relying solely on the final layer of a model like RoBERTa might discard valuable syntactic and lexical information present in earlier layers, which could be critical for detecting machine-generated text.
  • Weighted averaging unlocks richer representations: By learning weights for each layer, the model can dynamically decide which linguistic features (lexical, syntactic, semantic) are most important for the detection task, leading to a more comprehensive representation.
  • Parameter-efficient tuning is key for generalization: Techniques like AdaLoRA are vital for preventing catastrophic forgetting and ensuring that fine-tuned models retain their ability to generalize to unseen data, especially in the context of LLMs.

Key Results

The paper reports results for Subtask A (monolingual) and Subtask B (multi-class classification).

For Subtask A, the organizers' computed results show:

  • Ours: Accuracy 0.7535
  • Baseline: Accuracy 0.8846

The authors' own computed results for Subtask A on their validation and official test sets are:

  • Our Dev: Accuracy 0.9900, F1 Score 0.9895
  • Official Dev: Accuracy 0.9598, F1 Score 0.9592
  • Official Test: Accuracy 0.7538, F1 Score 0.8092

For Subtask B, the organizers' computed results show:

  • Ours: Accuracy 0.7387
  • Baseline: Accuracy 0.7460

The authors' own computed results for Subtask B on their validation and official test sets are:

  • Our Dev: Accuracy 0.979, F1 ScoreMicro 0.979
  • Official Dev: Accuracy 0.9783, F1 ScoreMicro 0.9783
  • Official Test: Accuracy 0.7398, F1 ScoreMicro 0.7398

The authors note that their model, while performing well on their evaluation set, falls short on the official test set compared to the baseline, attributing this to potential issues with generalizing to unseen domains and generators.

Limitations and Future Work

The authors acknowledge that their model's performance on the official test set was lower than the baseline, suggesting that it might not generalize as well to unseen domains and generators. They hypothesize that more hyperparameter tuning and potentially better aggregation of token representations (beyond simple averaging) could improve generalization. Future work could explore more sophisticated methods for combining layer information and further investigate parameter-efficient tuning strategies for this task.

Summary updated

BibTeX
@inproceedings{datta2024weighted,
  author = {Ayan Datta and Aryan Chandramania and Radhika Mamidi},
  title = {{Weighted Layer Averaging RoBERTa for Black-Box Machine-Generated Text Detection}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2024},
}
Figure