File size: 2,970 Bytes
8c0676c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
---
license: apache-2.0
base_model: distilbert-base-uncased
tags:
- text-classification
- ai-detection
- human-vs-ai
- distilbert
- pytorch
language:
- en
datasets:
- Hello-SimpleAI/HC3
metrics:
- accuracy
- f1
pipeline_tag: text-classification
widget:
- text: "The quick brown fox jumps over the lazy dog. This is a simple sentence that demonstrates basic grammar."
  example_title: "Human-like text"
- text: "In conclusion, artificial intelligence represents a transformative technology that will continue to evolve and impact various sectors of society. Its applications are vast and its potential is limitless."
  example_title: "AI-like text"
---

# AI Text Detector - HC3 Dataset

This model is a fine-tuned DistilBERT model for detecting AI-generated text vs human-written text. It was trained on the HC3 dataset from Hugging Face.

## Model Details

- **Base Model**: distilbert-base-uncased
- **Task**: Binary text classification (Human vs AI-generated)
- **Dataset**: HC3 (Human ChatGPT Comparison Corpus)
- **Training Framework**: PyTorch + Transformers

## Usage

```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch

# Load model and tokenizer
tokenizer = AutoTokenizer.from_pretrained("VSAsteroid/ai-text-detector-hc3")
model = AutoModelForSequenceClassification.from_pretrained("VSAsteroid/ai-text-detector-hc3")

# Example prediction
text = "Your text here"
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=256)

with torch.no_grad():
    outputs = model(**inputs)
    predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
    
# Get prediction
predicted_class = torch.argmax(predictions, dim=-1).item()
confidence = torch.max(predictions).item()

label = "AI-Generated" if predicted_class == 1 else "Human-Written"
print(f"Prediction: {label} (Confidence: {confidence:.3f})")
```

## Labels

- 0: Human-Written
- 1: AI-Generated

## Training Details

- **Epochs**: 2-3
- **Batch Size**: 8-16
- **Learning Rate**: 2e-5
- **Max Sequence Length**: 256
- **Optimizer**: AdamW with linear scheduling

## Performance

The model achieves good performance on distinguishing between human-written and AI-generated text, particularly on the types of content present in the HC3 dataset.

## Limitations

- The model is trained specifically on the HC3 dataset and may not generalize well to other types of text
- Performance may vary depending on the AI model that generated the text
- Short texts may be more difficult to classify accurately

## Citation

If you use this model, please cite the HC3 dataset:

```bibtex
@misc{guo2023close,
    title={How Close is ChatGPT to Human Experts? Comparison Corpus, Evaluation, and Detection},
    author={Biyang Guo and Xin Zhang and Ziyuan Wang and Minqi Jiang and Jinran Nie and Yuxuan Ding and Jianwei Yue and Yupeng Wu},
    year={2023},
    eprint={2301.07597},
    archivePrefix={arXiv},
    primaryClass={cs.CL}
}
```