Code for loading computer-generated text datasets, training text classification models on these datasets, and evaluating adversarial text attacks against them.
Results published in the paper "Adversarial Robustness of Neural-Statistical Features in Detection of Generative Transformers".
pip install -r requirements.txt
These experiments rely on several data sources and machine learning models to operate. You must download these datasets and retrieve these models prior to running the code.
You'll need to run the following code from an environment where you have access to CUDA 11.0. For example, a server running Jupyter Notebook with CUDA 11
Download the required data into "data" path.
git clone git@github.com:openai/gpt-2-output-dataset.git
cd gpt-2-output-dataset
python download_dataset.py
Download the file "175b_samples.jsonl" from the repo https://github.com/openai/gpt-3 as "gpt3_175b_samples.jsonl"
Run the notebook "Construct_Datasets.ipynb"
This will convert the raw GPT-2 and GPT-3 test datasets into a format that is compatible with the Grover detection model and place them under "classification_data". These same output datasets will be used for evaluating the statistical SVM models.
You'll need the following data files.
idioms.txt cliche500.txt archaisms.txt
python -m spacy download en
Because the coreference resolution is busted. pip install git@github.com:stanfordnlp/stanza.git@dev
pip install mauve-text
Run through the notebooks in order. Intermediate data files can be used to avoid re-running sections (use data loading commands as appropriate).
@article{crothers2022adversarial,
title={Adversarial Robustness of Neural-Statistical Features in Detection of Generative Transformers},
author={Crothers, Evan and Japkowicz, Nathalie and Viktor, Herna and Branco, Paula},
journal={arXiv preprint arXiv:2203.07983},
year={2022}
}