File size: 4,731 Bytes
4f892e6
 
6b748a6
 
 
 
 
 
 
 
 
 
 
 
 
4f892e6
6b748a6
 
0d24b4c
 
 
 
4f892e6
 
 
 
 
6b748a6
 
 
 
 
 
0d24b4c
 
4f892e6
 
 
6b748a6
 
 
 
 
 
 
 
 
 
 
4f892e6
 
 
6b748a6
0d24b4c
4f892e6
 
6b748a6
 
0d24b4c
4f892e6
6b748a6
4f892e6
6b748a6
4f892e6
6b748a6
 
 
4f892e6
 
 
6b748a6
4f892e6
6b748a6
 
 
4f892e6
 
 
 
6b748a6
 
4f892e6
0d24b4c
4f892e6
6b748a6
4f892e6
6b748a6
 
01fed76
0d24b4c
4f892e6
6b748a6
 
 
 
01fed76
6b748a6
 
 
 
 
 
 
 
 
4f892e6
 
 
 
 
6b748a6
 
0d24b4c
4f892e6
 
 
6b748a6
0d24b4c
 
4f892e6
 
 
6b748a6
 
0d24b4c
6b748a6
 
 
 
 
 
4f892e6
6b748a6
4f892e6
6b748a6
 
 
4f892e6
 
 
6b748a6
0d24b4c
4f892e6
 
 
 
6b748a6
 
 
 
 
0d24b4c
 
 
 
4f892e6
 
 
6b748a6
 
0d24b4c
4f892e6
 
 
6b748a6
 
 
 
 
0d24b4c
 
 
 
 
 
4f892e6
 
 
6b748a6
 
 
0d24b4c
6b748a6
 
 
4f892e6
 
6b748a6
 
4f892e6
 
 
6b748a6
 
4f892e6
 
 
6b748a6
0d24b4c
4f892e6
 
6b748a6
4f892e6
 
 
6b748a6
 
 
 
 
 
 
 
 
 
 
 
 
0d24b4c
 
 
 
 
 
 
 
 
 
 
 
4f892e6
6b748a6
4f892e6
6b748a6
4f892e6
6b748a6
 
 
 
 
 
 
 
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
---
library_name: transformers
tags:
- AI text detection
- human vs AI classification
- BERT fine-tuning
- Human vs AI text classification
- text-detection
license: mit
language:
- en
metrics:
- accuracy
base_model:
- google-bert/bert-base-uncased
---
# Model Card for BERT AI Detector






## Model Details

### Model Description

This model is a fine-tuned BERT designed to classify text as either AI-generated or human-written. The model was trained on data from the [Kaggle LLM Detect competition](https://www.kaggle.com/competitions/llm-detect-ai-generated-text/data) using variable-length text inputs ranging from 5 to 100 words. The fine-tuned model achieves high accuracy in identifying the source of the text, making it a valuable tool for detecting AI-generated content.











- **Developed by:** Pritam
- **Language(s) (NLP):** English
- **License:** Apache 2.0
- **Finetuned from model:** BERT (base-uncased)

### Model Sources

- **Repository:** [Hugging Face Model Card](https://huggingface.co/pritam2014/BERTAIDetector)
- **Demo:** [Streamlit Interface](https://huggingface.co/spaces/pritam2014/BERTAIDetector)


## Uses



### Direct Use

The model is intended for use in detecting whether text is AI-generated or human-written. Users can input text snippets into the demo or directly integrate the model into their applications for automated content classification.



### Downstream Use

Potential downstream uses include:

- Moderating AI-generated content in online platforms.
- Academic and journalistic content verification.
- Detecting plagiarism or misuse of AI writing tools.

### Out-of-Scope Use

The model is not suitable for:

- Detecting deeply paraphrased AI-generated text.
- Analysis of languages other than English.
- Scenarios where fairness and bias considerations are critical, as those have not been explicitly addressed.

## Bias, Risks, and Limitations





### Recommendations

Users should be aware that:

- The model may not perform well on text heavily modified from AI-generated content.
- It may produce false positives or false negatives due to the inherent limitations of the dataset or model architecture.

## How to Get Started with the Model

Use the following code snippet to load the model:

```python
from transformers import AutoTokenizer, AutoModelForSequenceClassification

tokenizer = AutoTokenizer.from_pretrained("pritamdeb68/BERTAIDetector")
model = AutoModelForSequenceClassification.from_pretrained("pritamdeb68/BERTAIDetector")

text = "Your text here"
inputs = tokenizer(text, return_tensors="pt")
outputs = model(**inputs)
predictions = outputs.logits.argmax(dim=1).item()
print("AI-generated" if predictions == 1 else "Human-written")
```

## Training Details

### Training Data

The training dataset was sourced from the [Kaggle LLM Detect competition](https://www.kaggle.com/competitions/llm-detect-ai-generated-text/data). The data includes examples of both AI-generated and human-written text, spanning various input lengths (5-100 words).



### Training Procedure

#### Preprocessing





- Text was tokenized using BERT's tokenizer.
- Input lengths ranged between 5 and 100 words, padded or truncated as necessary.

#### Training Hyperparameters

- **Batch Size:** 300
- **Optimizer:** AdamW
- **Learning Rate:** 1e-5
- **Epochs:** 1

#### Speeds, Sizes, Times

- **Training Time:** 1 hour 10 minutes
- **Hardware Used:** GPU (Kaggle T4 x 2)
- **Loss:** 0.12 on train data

## Evaluation



### Testing Data, Factors & Metrics

#### Testing Data

Validation data from the Kaggle competition was used for evaluation.









#### Metrics

- **Accuracy:** 96.65% on validation data.



### Results

The model achieved high accuracy and low validation loss, demonstrating its effectiveness for the task of AI text detection.











## Environmental Impact

Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute):



- **Hardware Type:** Kaggle T4 (x2) GPU
- **Training Duration:** 1 hour 10 minutes
- **Compute Region:** Not specified



## Technical Specifications

### Model Architecture and Objective

- **Model Architecture:** BERT (base-uncased) fine-tuned for text classification.
- **Objective:** Binary classification of text into AI-generated or human-written categories.

### Compute Infrastructure



#### Hardware

- **Type:** Kaggle T4(x2) GPU

#### Software

- **Framework:** PyTorch with Transformers library

























## Citation

If you use this model, please cite the repository:

```
@inproceedings{pritam2024bertaidetector,
  title={BERT AI Detector},
  author={Pritam},
  year={2024},
  url={https://huggingface.co/pritam2014/BERTAIDetector}
}
```