SA-Yur-or commited on
Commit
3814aac
1 Parent(s): abbff54

[up]: Update README and license

Browse files
Files changed (3) hide show
  1. LICENSE +24 -0
  2. README.md +112 -0
  3. SA_logo.png +0 -0
LICENSE CHANGED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ SuperAnnotate AI Public License (SAIPL)
2
+ Version 1.0
3
+ This License governs the use, modification, and distribution of AI models provided by SuperAnnotate AI on the Hugging Face platform, ensuring open access and collaboration in the AI community under the principles of the GNU Affero General Public License.
4
+ 1. Definitions
5
+ "This License" refers to version 1.0 of the SuperAnnotate AI Public License.
6
+ "The Model" refers to the AI model, including scripts, data, documentation, and any associated media provided by SuperAnnotate AI under this License.
7
+ "Modify" means to adapt or change the Model to create a derivative work.
8
+ "You" means any individual or entity exercising permissions granted by this License.
9
+ 2. Source Code
10
+ The source code includes all the contents that SuperAnnotate AI provides to modify the Model, including trained models, training scripts, and relevant data sets.
11
+ You must make all source code of the Model, and of any modifications, available to any user interacting with the Model remotely through a network.
12
+ 3. Commercial Use
13
+ Commercial use of the Model is permitted under this License. You may charge a fee for the physical act of transferring a copy, and you may also offer support or warranty protection for a fee.
14
+ If you use the Model commercially, you must disclose the source and make the entire source code available to your users, either commercially or freely under the terms of this License.
15
+ 4. Copyleft
16
+ All modified versions of the Model, and any derivative works thereof, must be licensed under this License or a compatible open source license that includes the same conditions, particularly regarding the availability of source code.
17
+ 5. Network Use is Distribution
18
+ If you make the Model or any modified version available to interact with users over a network, you must provide all users with access to the source code of the Model and any modifications, under the terms of this License.
19
+ 6. Attribution
20
+ You must give appropriate credit to SuperAnnotate AI, provide a link to this license, and indicate if changes were made. Such notice may not be removed or altered from any source distribution.
21
+ 7. Disclaimer of Warranty and Limitation of Liability
22
+ There is no warranty for the Model, to the extent permitted by applicable law. Except when otherwise stated in writing, the copyright holders and/or other parties provide the Model "as is" without warranty of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the Model is with you. Should the Model prove defective, you assume the cost of all necessary servicing, repair, or correction.
23
+ In no event unless required by applicable law or agreed to in writing will any copyright holder, or any other party who modifies and/or conveys the Model as permitted above, be liable to you for damages, including any general, special, incidental, or consequential damages arising out of the use or inability to use the Model (including but not limited to loss of data or data being rendered inaccurate or losses sustained by you or third parties or a failure of the Model to operate with any other programs), even if such holder or other party has been advised of the possibility of such damages.
24
+ End of Terms and Conditions
README.md CHANGED
@@ -2,4 +2,116 @@
2
  license: other
3
  license_name: saipl
4
  license_link: LICENSE
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: other
3
  license_name: saipl
4
  license_link: LICENSE
5
+ datasets:
6
+ - wikimedia/wikipedia
7
+ - rexarski/eli5_category
8
+ language:
9
+ - en
10
+ base_model:
11
+ - FacebookAI/roberta-large
12
+ pipeline_tag: text-classification
13
+ library_name: transformers
14
+ tags:
15
+ - genereted_text_detection
16
+ - llm_content_detection
17
+ - AI_detection
18
  ---
19
+ <p align="center">
20
+ <img src="SA_logo.png" alt="SuperAnnotate Logo" width="100" height="100"/>
21
+ </p>
22
+
23
+ <h1 align="center">SuperAnnotate</h1>
24
+ <h3 align="center">
25
+ AI Detector<br/>
26
+ Fine-Tuned RoBERTa Large<br/>
27
+ </h3>
28
+
29
+ ## Description
30
+
31
+ The model designed to detect generated/synthetic text. \
32
+ At the moment, such functionality is critical for determining the author of the text. It's critical for your training data, detecting fraud and cheating in scientific and educational areas. \
33
+ Couple of articles about this problem: [*Problems with Synthetic Data*](https://www.aitude.com/problems-with-synthetic-data/) | [*Risk of LLMs in Education*](https://publish.illinois.edu/teaching-learninghub-byjen/risk-of-llms-in-education/)
34
+
35
+ ## Model Details
36
+
37
+ ### Model Description
38
+
39
+ - **Model type:** The custom architecture for binary sequence classification based on pre-trained RoBERTa, with a single output label.
40
+ - **Language(s):** Primarily English.
41
+ - **License:** [SAIPL](https://huggingface.co/SuperAnnotate/roberta-large-llm-content-detector-V2/blob/main/LICENSE)
42
+ - **Finetuned from model:** [RoBERTa Large](https://huggingface.co/FacebookAI/roberta-large)
43
+
44
+ ### Model Sources
45
+
46
+ - **Repository:** [GitHub](https://github.com/superannotateai/generated_text_detector) for HTTP service
47
+
48
+ ### Training Data
49
+
50
+ The training dataset for this version includes **44k pairs of text-label samples**, split equally between two parts:
51
+
52
+ 1. **Custom Generation**: The first half of the dataset was generated using custom specially designed prompts and human version sourced from three domains:
53
+ - [**Wikipedia**](https://huggingface.co/datasets/wikimedia/wikipedia)
54
+ - [**Reddit ELI5 QA**](https://huggingface.co/datasets/rexarski/eli5_category)
55
+ - [**Scientific Papers**](https://www.tensorflow.org/datasets/catalog/scientific_papers) (extended to include the full text of sections).
56
+
57
+ Texts were generated by 14 different models across four major LLM families (GPT, LLaMA, Anthropic, and Mistral). Each sample consists of a single prompt paired with one human-written and one generated response, though prompts were excluded from training inputs.
58
+
59
+ 2. **RAID Train Data Stratified Subset**: The second half is a carefully selected stratified subset from the RAID train dataset, ensuring equal representation across domains, model types, and attack methods. Each example pairs a human-authored text with a corresponding machine-generated response (produced by a single model with specific parameters and attacks applied).
60
+
61
+ This balanced dataset structure maintains approximately equal proportions of human and generated text samples, ensuring that each prompt aligns with one authentic and one generated answer.
62
+
63
+ > [!NOTE]
64
+ > Furthermore, key n-grams (n ranging from 2 to 5) that exhibited the highest correlation with target labels were identified and subsequently removed from the training data utilizing the chi-squared test.
65
+
66
+ ### Peculiarity
67
+
68
+ In training, a primary objective was to maximize prediction accuracy while specifically minimizing the False Positive Rate (FPR), prioritizing the reduction of misclassifications in class 0 (i.e., reducing instances where human-written text is incorrectly classified as generated by an LLM).
69
+
70
+ ## Usage
71
+
72
+ **Pre-requirements**: \
73
+ Install *generated_text_detector* \
74
+ Run following command: ```pip install git+https://github.com/superannotateai/generated_text_detector.git@v1.0.0```
75
+
76
+ ```python
77
+ from generated_text_detector.utils.model.roberta_classifier import RobertaClassifier
78
+ from transformers import AutoTokenizer
79
+ import torch.nn.functional as F
80
+ model = RobertaClassifier.from_pretrained("SuperAnnotate/ai-detector")
81
+ tokenizer = AutoTokenizer.from_pretrained("SuperAnnotate/ai-detector")
82
+ text_example = "It's not uncommon for people to develop allergies or intolerances to certain foods as they get older. It's possible that you have always had a sensitivity to lactose (the sugar found in milk and other dairy products), but it only recently became a problem for you. This can happen because our bodies can change over time and become more or less able to tolerate certain things. It's also possible that you have developed an allergy or intolerance to something else that is causing your symptoms, such as a food additive or preservative. In any case, it's important to talk to a doctor if you are experiencing new allergy or intolerance symptoms, so they can help determine the cause and recommend treatment."
83
+ tokens = tokenizer.encode_plus(
84
+ text_example,
85
+ add_special_tokens=True,
86
+ max_length=512,
87
+ padding='longest',
88
+ truncation=True,
89
+ return_token_type_ids=True,
90
+ return_tensors="pt"
91
+ )
92
+ _, logits = model(**tokens)
93
+ proba = F.sigmoid(logits).squeeze(1).item()
94
+ print(proba)
95
+ ```
96
+
97
+ ## Training Detailes
98
+
99
+ A custom architecture was chosen for its ability to perform binary classification while providing a single model output, as well as for its customizable settings for smoothing integrated into the loss function.
100
+
101
+ **Training Arguments**:
102
+
103
+ - **Base Model**: [FacebookAI/roberta-large](https://huggingface.co/FacebookAI/roberta-large)
104
+ - **Epochs**: 15
105
+ - **Learning Rate**: 5e-05
106
+ - **Weight Decay**: 0.0033
107
+ - **Label Smoothing**: 0
108
+ - **Pos Weight of Loss**: 0.5
109
+ - **Warmup Epochs**: 2
110
+ - **Optimizer**: SGD
111
+ - **Gradient Clipping**: 3.0
112
+ - **Scheduler**: Cosine with hard restarts
113
+ - **Number Scheduler Cycles**: 1
114
+
115
+ ## Performance
116
+
117
+ **TODO** RAID Leaderboard results should be here
SA_logo.png ADDED