Instructions to use bibbbu/multilingual-ai-human-detector_xlm-roberta-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bibbbu/multilingual-ai-human-detector_xlm-roberta-base with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="bibbbu/multilingual-ai-human-detector_xlm-roberta-base")# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("bibbbu/multilingual-ai-human-detector_xlm-roberta-base") model = AutoModelForSequenceClassification.from_pretrained("bibbbu/multilingual-ai-human-detector_xlm-roberta-base", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Multilingual AI-vs-Human Text Detector โ XLM-RoBERTa-base
A binary classifier that detects whether a passage was written by a human or generated by an AI model, fine-tuned from XLM-RoBERTa-base to work across English, Chinese, and Vietnamese with a single checkpoint.
Built as an AI content forensics research project: the full system โ data pipeline, statistical baselines, per-language evaluation, REST API, and web demo โ lives in the companion repository.
- ๐ฆ GitHub (full project): https://github.com/vutuongvy101/multilingual-ai-human-text-detection
- ๐ฉโ๐ป Author: Tuong Vy Vu โ GitHub ยท LinkedIn
Why a multilingual detector?
Monolingual detectors fail badly outside their pre-training language: in the same experimental setup, an English-only DistilBERT drops to F1 0.784 on Chinese (vs 0.977 on English) because Chinese characters tokenise into meaningless subword fragments. This model uses multilingual pre-training to hold F1 0.946โ0.989 across all three languages โ evidence that cross-lingual AI-content detection requires multilingual representations, not per-language models.
Evaluation
Test-set F1 (70/15/15 prompt-level split, seed 42; 90 test samples per language, 270 total):
| Language | F1 |
|---|---|
| English | 0.9890 |
| Vietnamese | 0.9783 |
| Chinese | 0.9462 |
| Overall | 0.9710 |
Comparison against baselines trained on the same data (full table, confusion matrices, and analysis in the GitHub README):
| Model | Overall F1 |
|---|---|
| Logistic Regression (TF-IDF) | 0.9776 |
| XLM-RoBERTa (this model) | 0.9710 |
| Multinomial NB (TF-IDF) | 0.9181 |
| DistilBERT | 0.8960 |
Note that the TF-IDF logistic regression baseline is competitive in-domain โ the value of this transformer model is expected in robustness to paraphrase and vocabulary shift, which n-gram features cannot capture (see Limitations).
Training
- Base model:
FacebookAI/xlm-roberta-base(~279M params), sequence classification head, F32. - Data: 900 QA pairs (300 per language), each with one human and one AI answer:
- English โ HC3 (
reddit_eli5) - Chinese โ HC3-Chinese (
open_qa) - Vietnamese โ crawled from Vietnamese Reddit communities
- AI answers generated by Qwen2.5-1.5B-Instruct
- English โ HC3 (
- Setup: fine-tuned 3 epochs, learning rate
2e-5,max_length=256, prompt-level 70/15/15 train/val/test split (seed 42) so no question appears in both train and test. - Reproduce:
python scripts/train_transformer.py --model-name xlm-roberta-basein the GitHub repo.
Usage
from transformers import pipeline
detector = pipeline(
"text-classification",
model="bibbbu/multilingual-ai-human-detector_xlm-roberta-base",
)
texts = [
"Honestly I just left it overnight and it worked fine, no idea why lol",
"There are several important factors to consider when addressing this question.",
]
print(detector(texts))
# [{'label': 'human', 'score': ...}, {'label': 'ai', 'score': ...}]
For batch inference, a FastAPI server, and a Streamlit demo, see the GitHub repository.
Intended use & limitations
Intended use: research on cross-lingual AI-text detection; educational and portfolio use; experimentation with content-authenticity pipelines.
Limitations โ read before relying on predictions:
- โ ๏ธ Do not use this model alone for high-stakes decisions (academic-misconduct accusations, content moderation enforcement, hiring). AI-text detectors produce false positives, and non-native writers are a known false-positive risk for detectors in general.
- Generator specificity: AI-labelled training text comes from a single generator (Qwen2.5-1.5B-Instruct). Detection of text from other models (GPT-4-class, Claude, Gemini) is untested and likely weaker.
- Domain shift: trained on QA-style forum answers; performance on news, legal, academic, or social-media text is untested.
- Small evaluation set: 270 test samples total; strong scores should be confirmed on larger, held-out domains before any production use.
- Language coverage: English, Chinese, Vietnamese only.
Citation
@misc{vu2024multilingual,
title = {Multilingual AI-Human Text Detection},
author = {Vu, Tuong Vy},
year = {2024},
url = {https://github.com/vutuongvy101/multilingual-ai-human-text-detection}
}
- Downloads last month
- 3,983
Model tree for bibbbu/multilingual-ai-human-detector_xlm-roberta-base
Base model
FacebookAI/xlm-roberta-baseSpace using bibbbu/multilingual-ai-human-detector_xlm-roberta-base 1
Evaluation results
- F1 (overall, EN+ZH+VI test set) on Multilingual QA corpus (HC3 / HC3-Chinese / Vietnamese Reddit)self-reported0.971
- F1 (English) on Multilingual QA corpus (HC3 / HC3-Chinese / Vietnamese Reddit)self-reported0.989
- F1 (Chinese) on Multilingual QA corpus (HC3 / HC3-Chinese / Vietnamese Reddit)self-reported0.946
- F1 (Vietnamese) on Multilingual QA corpus (HC3 / HC3-Chinese / Vietnamese Reddit)self-reported0.978