| --- |
| language: bn |
| license: mit |
| tags: |
| - text-classification |
| - bangla |
| - bengali |
| - ai-detection |
| - human-vs-ai |
| - fine-tuned |
| base_model: csebuetnlp/banglabert |
|
|
| metrics: |
| - accuracy |
| - f1 |
| pipeline_tag: text-classification |
| --- |
| |
| # Bangla AI vs Human Writing Detector — BanglaBERT |
|
|
| Fine-tuned [BanglaBERT](https://huggingface.co/csebuetnlp/banglabert) for **binary classification of Bangla text as AI-generated or human-written**. Developed as part of the *Onneshon* thesis project at Bangladesh University of Professionals (BUP). |
|
|
| Given the full text of a Bangla resume, the model predicts whether it was written by a human or generated by an AI system, along with a confidence score. |
|
|
| --- |
|
|
| ## Model Details |
|
|
| | Property | Value | |
| |---|---| |
| | Base model | `csebuetnlp/banglabert` | |
| | Architecture | ElectraForSequenceClassification (ELECTRA-based BERT) | |
| | Parameters | 12 layers, 768 hidden dim, 12 attention heads, vocab 32,000 | |
| | Language | Bengali (bn) | |
| | Task | Binary sequence classification | |
| | Labels | `0` → Human, `1` → AI | |
| | Max input tokens | 512 | |
| | Training data | 70 resumes (35 AI + 35 Human) | |
| | Validation data | ~15 resumes (stratified) | |
| | Test data | ~15 resumes (stratified) | |
| | Epochs | 5 (with EarlyStoppingCallback, patience=2) | |
| | Learning rate | 2e-5 | |
| | Batch size | 8 | |
| | Warmup ratio | 0.1 | |
| | Weight decay | 0.01 | |
| | Mixed precision | fp16 | |
| | Best model metric | F1 (binary) | |
|
|
| --- |
|
|
| ## Dataset |
|
|
| Trained on **Onneshon** — an original Bangla resume dataset: |
|
|
| - **Human resumes:** 50 resumes written by Bangladeshi professionals (resume_51–resume_100) |
| - **AI resumes:** 50 resumes generated by AI systems (resume_1–resume_50) |
| - **Total:** 100 resumes, split 70/15/15 (train/val/test), stratified |
|
|
| Published on Mendeley Data: [DOI: 10.17632/4md7bx6fd7.1](https://doi.org/10.17632/4md7bx6fd7.1) |
|
|
| --- |
|
|
| ## Labels |
|
|
| | ID | Label | Description | |
| |---|---|---| |
| | 0 | Human | Resume written by a human | |
| | 1 | AI | Resume generated by an AI system | |
|
|
| --- |
|
|
| ## Usage |
|
|
| ```python |
| from transformers import AutoTokenizer, AutoModelForSequenceClassification |
| import torch |
| |
| tokenizer = AutoTokenizer.from_pretrained("your-username/bangla-ai-detector") |
| model = AutoModelForSequenceClassification.from_pretrained("your-username/bangla-ai-detector") |
| model.eval() |
| |
| def predict(text): |
| inputs = tokenizer(text, return_tensors="pt", truncation=True, max_length=512) |
| with torch.no_grad(): |
| logits = model(**inputs).logits |
| probs = torch.softmax(logits, dim=1)[0] |
| label = model.config.id2label[logits.argmax().item()] |
| return { |
| "label": label, |
| "confidence": f"{probs.max().item()*100:.1f}%", |
| "P(Human)": f"{probs[0].item()*100:.1f}%", |
| "P(AI)": f"{probs[1].item()*100:.1f}%", |
| } |
| |
| # Example |
| resume_text = "আমি একজন অভিজ্ঞ সফ্টওয়্যার ইঞ্জিনিয়ার। গত পাঁচ বছর ধরে জাভা এবং স্প্রিং বুট দিয়ে কাজ করছি।" |
| print(predict(resume_text)) |
| # Output: {'label': 'Human', 'confidence': '87.3%', 'P(Human)': '87.3%', 'P(AI)': '12.7%'} |
| ``` |
|
|
| --- |
|
|
| ## Preprocessing |
|
|
| Before passing text to the model, strip any annotation tags if present (these are specific to the Onneshon dataset format): |
|
|
| ```python |
| import re |
| |
| def clean_resume(text): |
| text = re.sub(r'\[Info_Start\].*?\[Info_End\]', '', text, flags=re.DOTALL) |
| text = re.sub(r'\[(Objective|Experience|Expericence|Education|Skill|section)\]', '', text) |
| text = re.sub(r'\s+', ' ', text).strip() |
| return text |
| ``` |
|
|
| --- |
|
|
| ## Limitations |
|
|
| - **Small dataset:** Only 100 resumes (70 training). Binary accuracy estimates have high variance — results should be interpreted with caution. |
| - **Domain-specific:** Trained exclusively on Bangla resumes. Performance on other Bangla document types (news, social media, etc.) is untested. |
| - **AI source unknown:** The AI resumes were generated by a specific AI system. The model may not generalize to resumes generated by different LLMs not seen during training. |
| - **Token limit:** Resumes longer than 512 tokens are truncated. Very long resumes may lose tail content. |
| - **Binary only:** Cannot distinguish *which* AI system generated the text — only Human vs AI. |
|
|
| --- |
|
|
| ## Citation |
|
|
| ```bibtex |
| @misc{onneshon2026, |
| title = {Onneshon: A Bangla Resume NLP Dataset}, |
| author = {Tanvir and Shruti Khisa and Shaira Akther Diba and Fazli Rabbi Noor}, |
| year = {2026}, |
| doi = {10.17632/4md7bx6fd7.1}, |
| publisher = {Mendeley Data} |
| } |
| |
| @inproceedings{bhattacharjee-etal-2022-banglabert, |
| title = {BanglaBERT: Language Model Pretraining and Benchmarks for Low-Resource Language Understanding Evaluation in Bangla}, |
| author = {Bhattacharjee, Abhik and Hasan, Tahmid and Ahmad, Wasi and Mubasshir, Kazi Samin and Islam, Md Saiful and Iqbal, Anindya and Rahman, M. Sohel and Shahriyar, Rifat}, |
| booktitle = {Findings of the Association for Computational Linguistics: NAACL 2022}, |
| year = {2022}, |
| pages = {1318--1327} |
| } |
| ``` |
|
|
| --- |
|
|
| ## Project |
|
|
| Part of the **Onneshon** thesis project — a Bangla NLP pipeline for resume processing. |
|
|
| - Dataset: [Mendeley Data DOI: 10.17632/4md7bx6fd7.1](https://doi.org/10.17632/4md7bx6fd7.1) |
| - Institution: Bangladesh University of Professionals (BUP), Dhaka, Bangladesh |
| - Supervisor: Rumana Yasmin, Lecturer, CSE Department, BUP |
|
|