This BERT-based classifier is trained to distinguish coherent human-written text from text generated by a Markov chain.
As expected, the classifier achieves near-perfect performance (98.2% accuracy on evaluation set), largely because BERT’s attention mechanism captures long-range contextual dependencies, whereas a Markov model relies only on the previous state.
To get started with this model in Python using the Hugging Face Transformers library, run the following code:
1from transformers import AutoTokenizer, AutoModelForSequenceClassification
2import torch
3
4model_id = "agentlans/GIST-small-markov-slop-detector"
5tokenizer = AutoTokenizer.from_pretrained(model_id)
6model = AutoModelForSequenceClassification.from_pretrained(model_id)
7
8text = "Replace this with your input text."
9inputs = tokenizer(text, return_tensors="pt")
10
11with torch.no_grad():
12 logits = model(**inputs).logits
13
14predicted_class_id = logits.argmax().item()
15predicted_class_name = model.config.id2label[predicted_class_id]
16
17print(f"Predicted Class ID: {predicted_class_id}")
18print(f"Predicted Class Name: {predicted_class_name}")
This model is designed for sequence classification tasks. Below are the specific class labels mapped to their corresponding IDs:
During fine-tuning, the model achieved the following results on the evaluation set: