Downloads · 30 days
5
12% of all-time downloads
kunkun2/hw1-hc3-detector-v1
hw1-hc3-detector-v1 is a text classification model from kunkun2. Use it when you need a label for a piece of text. It is set up for transformers.
This model is a binary text classifier fine-tuned to distinguish between human-written text and ChatGPT-generated text.
Downloads · 30 days
5
12% of all-time downloads
All-time downloads
41
Public
Parameters
22.7M
90.9 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors90.9 MB · 99%
From the Hugging Face model README
This model is a binary text classifier fine-tuned to distinguish between human-written text and ChatGPT-generated text.
The model was trained and evaluated on data derived from the HC3 dataset as part of an NLP classification assignment.
The model takes a piece of English text as input and predicts whether the text is more likely to have been written by a human or generated by ChatGPT.
The model can be used with the Hugging Face text-classification pipeline:
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="kunkun2/hw1-hc3-detector-v1"
)
text = "Enter the text that you want to classify here."
result = classifier(text)
print(result)
Alternatively, it can be loaded with AutoTokenizer and
AutoModelForSequenceClassification:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
model_id = "kunkun2/hw1-hc3-detector-v1"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForSequenceClassification.from_pretrained(model_id)
text = "Enter the text that you want to classify here."
inputs = tokenizer(
text,
return_tensors="pt",
truncation=True,
padding=True
)
with torch.no_grad():
logits = model(**inputs).logits
predicted_class_id = logits.argmax(dim=-1).item()
predicted_label = model.config.id2label[predicted_class_id]
print(predicted_label)
The exact label-to-class mapping can be inspected with:
print(model.config.id2label)
print(model.config.label2id)
This model is intended for:
This model should not be used as the sole basis for:
The prediction represents a statistical estimate, not proof of authorship.
The model was trained using data derived from the HC3 dataset, which contains human-written and ChatGPT-generated answers.
The dataset was split into:
| Split | Number of examples |
|---|---|
| Training | 37,334 |
| Validation | 4,666 |
| Test | 4,668 |
The text was tokenized with the model tokenizer and processed using truncation and padding. A pretrained transformer sequence-classification model was then fine-tuned for binary classification.
The training procedure used the training split for parameter updates and the validation split for evaluation during model development. Final performance was measured on the held-out test split.
Accuracy was used as the primary evaluation metric:
\frac{\text{Number of correct predictions}} {\text{Total number of predictions}} ]
| Model | Test accuracy |
|---|---|
| Baseline classifier | 0.8449 |
| Fine-tuned transformer | 0.9891 |
The fine-tuned model achieved a test accuracy of 98.91%, compared with 84.49% for the baseline.
The fine-tuned result also exceeds the assignment target accuracy of 0.90.
AI-generated text detection is inherently uncertain. Important limitations include:
Predictions should be treated as supporting evidence only. For consequential decisions, users should combine the model output with human review, contextual information, and additional verification methods.
The model should be evaluated on data from the intended deployment domain before practical use.
The reported results were produced using the training and evaluation code submitted separately through Canvas.
If you use the HC3 dataset, please cite its original paper:
@article{guo2023hc3,
title={How Close is ChatGPT to Human Experts? Comparison Corpus,
Evaluation, and Detection},
author={Guo, Biyang and Zhang, Xin and Wang, Ziyuan and Jiang, Minqi
and Nie, Jinran and Ding, Yuxuan and Yue, Jianwei and Wu, Yupeng},
journal={arXiv preprint arXiv:2301.07597},
year={2023}
}
This model was created for educational purposes. Its predictions should not be interpreted as definitive evidence that a text was written by a human or generated by an AI system.