Bert Transformer model for Detecting Arabic GPT2 Auto-Generated Tweets

Fouzi Harrag, Maria Dabbah, Kareem Darwish, Ahmed Abdelali

TL;DR

This paper tackles the growing problem of AI-generated "deepfake" text on social media, specifically focusing on Arabic tweets. The authors introduce a novel approach by combining GPT-2 for generating synthetic Arabic deepfake tweets and then using a fine-tuned AraBERT model for their detection, achieving a remarkable 98.7% accuracy. This work represents a significant step in combating sophisticated AI-driven misinformation campaigns in the Arabic language.

What Problem Does This Paper Address?

In recent years, the internet and social media have become primary sources of news and information, especially for younger demographics in the Arab world. However, this has also led to a surge in fabricated content and misinformation. The advent of powerful language models like GPT-2 has enabled the creation of highly human-like "deepfake" texts that can be used by bots to spread false narratives and evade detection. These AI-generated texts can mimic human writing so effectively that distinguishing them from genuine content becomes a significant challenge. The paper specifically addresses the need for robust methods to detect such auto-generated Arabic text, a domain that has seen less research compared to English.

Methods

The core of this research lies in a two-pronged approach: generation and detection.

  1. Deepfake Text Generation: The authors leverage GPT2-Small-Arabic, a pre-trained language model specifically for Arabic, to generate synthetic "deepfake" tweets. These generated texts are seeded using human-generated Arabic tweets from their custom dataset, aiming to mimic the style and content of real user posts.
  2. Deepfake Text Detection: For detection, the paper proposes a transfer learning-based model. They fine-tune AraBERT, a BERT model pre-trained on a large Arabic corpus. This fine-tuning process adapts the powerful language understanding capabilities of AraBERT to the specific task of classifying Arabic tweets as either human-generated or AI-generated.

As a baseline for comparison, the authors also implement and evaluate four traditional Recurrent Neural Network (RNN) models: LSTM, biLSTM, GRU, and biGRU, using word embeddings.

Datasets

The paper introduces a new, custom dataset for detecting Arabic deepfake text.

  • Human Generated Set: This set was initially based on 1,559 "human content" tweets from a previous study (Almerekhi and Elsayed, 2015). To augment this, they expanded it by crawling tweets from the same user timelines, assuming that accounts producing human content are unlikely to produce bot content. After cleaning (removing deleted tweets, etc.), this set contains 4,196 human-generated tweets.
  • Deepfake Set: This set comprises 3,512 AI-generated Arabic tweets created using GPT2-Small-Arabic, seeded from the human-generated set. The generated texts range from 15 to 35 words.

The combined dataset was split into 80% for training and 20% for testing.

Key Insights and Ideas

  • The Power of Transfer Learning for Arabic Deepfakes: The study strongly suggests that pre-trained transformer models like AraBERT are significantly more effective at detecting AI-generated Arabic text than traditional RNN architectures. This highlights the advantage of contextual embeddings and attention mechanisms in capturing subtle linguistic cues indicative of AI generation.
  • GPT-2 as a Realistic Deepfake Generator: The successful generation of plausible deepfake Arabic tweets using GPT2-Small-Arabic demonstrates the increasing sophistication of generative models and underscores the urgency for effective detection methods.
  • AraBERT Outperforms RNNs: The quantitative results clearly show that AraBERT achieves superior performance across all metrics compared to the RNN baselines, indicating its suitability for this specialized task.
  • Bidirectional RNNs Offer Improvement: Among the RNN baselines, bidirectional architectures (biLSTM and biGRU) consistently outperformed their unidirectional counterparts, suggesting that considering context from both directions is beneficial for this task.

Key Results

The proposed AraBERT-based model achieved a high accuracy of 98.7% in detecting auto-generated Arabic tweets. This significantly outperformed the best-performing RNN baseline, biLSTM, which achieved an accuracy of 96.3%. The AraBERT model also demonstrated superior performance in Precision (98.5%) and Recall (98.9%), leading to the highest F1-Score (98.7%). The improvements over the RNN baselines were substantial, ranging from +2.4% to +4.0% in accuracy.

Limitations and Future Work

  • Limitations: The authors acknowledge that while their dataset is custom-built, it's based on a simplifying assumption that human-content accounts don't produce bot content. They also note that some accounts and tweets were deleted, leading to data loss. The paper doesn't extensively discuss the computational cost or inference speed of the AraBERT model compared to RNNs.
  • Future Work: The authors plan to use explainability tools to understand why the AraBERT model is successful. They hypothesize that the model might be detecting patterns like text repetition or specific stylistic choices characteristic of GPT2-generated text. Further research could explore more advanced generative models and detection techniques, as well as investigate the model's robustness against adversarial attacks.

Summary updated

Abstract

During the last two decades, we have progressively turned to the Internet and social media to find news, entertain conversations and share opinion. Recently, OpenAI has developed a ma-chine learning system called GPT-2 for Generative Pre-trained Transformer-2, which can pro-duce deepfake texts. It can generate blocks of text based on brief writing prompts that look like they were written by humans, facilitating the spread false or auto-generated text. In line with this progress, and in order to counteract potential dangers, several methods have been pro-posed for detecting text written by these language models. In this paper, we propose a transfer learning based model that will be able to detect if an Arabic sentence is written by humans or automatically generated by bots. Our dataset is based on tweets from a previous work, which we have crawled and extended using the Twitter API. We used GPT2-Small-Arabic to generate fake Arabic Sentences. For evaluation, we compared different recurrent neural network (RNN) word embeddings based baseline models, namely: LSTM, BI-LSTM, GRU and BI-GRU, with a transformer-based model. Our new transfer-learning model has obtained an accuracy up to 98%. To the best of our knowledge, this work is the first study where ARABERT and GPT2 were combined to detect and classify the Arabic auto-generated texts.
BibTeX
@inproceedings{harrag2020bert,
  author = {Fouzi Harrag and Maria Dabbah and Kareem Darwish and Ahmed Abdelali},
  title = {{Bert Transformer model for Detecting Arabic GPT2 Auto-Generated Tweets}},
  booktitle = {WANLP @ COLING},
  year = {2020},
}
Figure