# isiZulu AI-Detection Classifier
## Overview
This project is a binary text classifier that detects whether a piece of isiZulu text was written by a human or generated by an AI language model. It addresses a gap in AI-detection tooling, which has historically focused on high-resource languages like English while leaving low-resource African languages underserved.
The classifier is fine-tuned on top of **AfroXLMR-Large** — a 559.9M parameter XLM-RoBERTa variant pre-trained specifically on African languages. This makes it a far stronger base for isiZulu than a generic multilingual model, as it already has deep morphological and syntactic knowledge of the language before fine-tuning begins.
**Unique features:**
- Built entirely for isiZulu, a Bantu language with complex agglutinative morphology that generic detectors handle poorly
- Custom dataset constructed from scratch: human text sourced from the NCHLT isiZulu corpus and Isolezwe newspaper, AI text generated via GPT-4o-mini across 30 topics and 20 writing styles with varied temperatures
- Sliding-window chunking aligned to the AfroXLMR tokenizer's 512-token limit with sentence overlap, preserving context at boundaries
- Achieves 98.70% accuracy and 98.72% F1 on a balanced 2,022-sample test set
Label `0` means human-written. Label `1` means machine-generated.
---
## Contents of the Zip File
```
isizulu-ai-detector/
├── scripts/
│ ├── finetune.py Training script — loads base model, fine-tunes on datasets/, saves to finetuned_model/
│ ├── test.py Evaluation script — loads finetuned_model/, runs inference on test sets, prints metrics
│ └── audit/
│ └── model_audit.py Runs Cleanlab data-quality analysis and SHAP explainability on the fine-tuned model
├── datasets/
│ ├── train.jsonl Training split (16,377 samples, balanced 50/50 human/AI)
│ ├── eval.jsonl Validation split (1,991 samples)
│ ├── test.jsonl …