This repository contains scripts and notebooks for detecting the usage of Large Language Models (LLMs) in emails. We employ two models for detection:
- SuperAnnotate/roberta-large-llm-content-detector
- Binoculars
build_scores.ipynb: Computes LLM detection scores using the SuperAnnotate model.build_scores_binocular.ipynb: Computes LLM detection scores using the Binoculars model.
Please contact us to obtain the Parquet files containing the emails used for detection.
We define three levels of granularity for LLM detection in emails:
- Email level
- Paragraph level
- Sentence level
We provide PNG files in the repository, displaying the detection scores obtained using different criteria.
We further fine-tune the SuperAnnotate model on generated data to specialize it for email detection.
newdata/: Contains code, data, and results related to fine-tuning.generate_mails_with_gpt.ipynb: Generates a synthetic dataset of emails.further_finetuning_with_emails.ipynb: Fine-tunes the model using generated emails.build_scores.ipynb: Generates scores and plots after fine-tuning.
We use pre-ChatGPT era emails as ground truth for human-written emails and generate new emails using GPT. These generated emails are labeled as GPT-written. The strategies used for generation are:
- Rewrite: Rephrase an existing human email.
- Merge: Merge several human-written emails into one.
- Generate: Create an email from scratch based on a detected topic.
We then fine-tune the model using emails generated through one or multiple strategies mentioned above.
Detection scores and plots are generated using build_scores.ipynb. Each plot is saved in a folder named 'strategy_' followed by the names of the generation techniques used.
For access to the dataset or further inquiries, please contact us.