Transformer-based NLP system for detecting AI-generated text in Arabic and English using models such as AraBERT, AraELECTRA, BERT, and DeBERTa.
# Deepfake Text Detection for Arabic and English Using BERT and ELECTRA-Based Models
A research project investigating how effectively fine-tuned transformer models can distinguish between human-written and AI-generated text, across both Arabic and English.
**Authors:** Amani Albarazi, Raghad Alamoudi, Maram Alhusami
**Supervised by:** Dr. Naila Marir
**Course:** CS4083 - Natural Language Processing & Text Mining, Effat University
**Date:** December 2025
## Overview
The rapid rise of large language models has made AI-generated text nearly indistinguishable from human writing, raising concerns around academic integrity, misinformation, and authorship authenticity. This project fine-tunes and evaluates transformer-based models for binary classification of human vs. AI-generated text, with dedicated pipelines for both Arabic and English.
## Datasets
- **ALHD** (A Large-Scale and Multigenre Benchmark Dataset for Arabic LLM-Generated Text Detection) — 20,268 Arabic samples (a balanced 10% subset of the full corpus), spanning news, tweets, reviews, health content, and conversational text. AI-generated portion produced by GPT-3.5-T.
- **balanced_ai_human_prompts** — 2,750 English samples, evenly split between human-written and GPT-3/GPT-3.5-generated prompts.
## Models
**Arabic:**
- AraBERT-Base
- AraBERT-Large
- AraELECTRA
**English:**
- DistilBERT
- BERT-base (EngBERT)
- DeBERTa-v3-base
## Methodology
1. Data cleaning and preprocessing (URL removal, lowercasing, whitespace normalization for English; tokenizer-based normalization for Arabic)
2. Tokenization with truncation/padding (max length 128 for Arabic, 256 for English)
3. Fine-tuning via HuggingFace `Trainer` (Arabic) and a custom PyTorch training loop (English)
4. Evaluation using accuracy and F1-score
5. Unified inference function for real-time prediction across all models
## Results
**Arabic models:**
| Model | Accuracy | F1-Score | Generalization |
|---|---|---|---|
| AraBERT-Large | 92.97% | 0.9327 …