โ† All projects

AI vs Human Text Detection

Can measurable text features tell AI writing from human writing?

Text & NLPPythonscikit-learnSciPySeaborn
1,000labelled texts
55%best accuracy
p = 0.043only significant feature

The question

Detecting machine-written text matters for education and publishing. I tested whether features such as perplexity, burstiness and lexical diversity are enough on their own.

What I did

Cleaned 1,000 labelled samples (463 marked AI, 537 marked human) and engineered text statistics.
Compared each feature between AI and human text with t-tests.
Trained logistic regression, random forest, gradient boosting and SVM models.
Checked results with confusion matrices, ROC curves and a PCA projection.

What I found

Only perplexity differed significantly between the groups (AI 56.1 against human 52.8, p = 0.043). Burstiness, coherence and diversity did not.
The best model, an SVM, reached 55% accuracy with a ROC AUC near 0.50, which is chance level.
It caught only 32% of AI texts. The curves in the ROC plot sit on the diagonal for every model.

Charts from the analysis

Key features look alike for AI and human text.
Key features look alike for AI and human text.
Model comparison across four classifiers.
Model comparison across four classifiers.
ROC curves hug the chance line.
ROC curves hug the chance line.

Limits to keep in mind

About the data

This is a negative result and I report it as one. With 1,000 samples and only summary features, there is little signal to learn. Working from the raw text would be the next step.

View the code on GitHub โ†—
โ† PreviousBrand Sentiment on Social MediaNext โ†’Gaming and Mental Health