jayhyeon83/data_augmentation
0
LLM-based Persona-Driven Text Data Augmentation for Drug-Dealing Dialogue Detection
This repository contains the code and sample data for our research paper "LLM-based Persona-Driven Text Data Augmentation" which addresses the critical data scarcity problem in illicit drug-dealing dialogue detection systems.
π Overview
Our framework generates synthetic drug-dealing dialogues using persona-driven LLM augmentation to train AI detection systems. From only 3 seed conversations, we generated 15,000 high-quality synthetic dialogues while preserving authentic linguistic patterns and behavioral dynamics.
π§ Setup
Prerequisites
pip install pandas openai tqdm
Configuration
Set your OpenAI API key as an environment variable:
bashexport OPENAI_API_KEY="your-api-key-here"
Or modify the code to load from a config file:
pythonimport os
openai.api_key = os.getenv("OPENAI_API_KEY")
π Usage
Basic Usage
pythonfrom drug_transaction_detector import DrugTransactionDetector
# Initialize the generator
generator = DrugTransactionDetector()
# Generate conversations
generator.generate_dataset(
start_id=1,
num_conversations=100,
output_file='generated_conversations.csv'
)
Sample Output Format
csvλνID,μν ,λνλ΄μ©
1,buyer,λ¬Έμμ
1,seller,λ€ μ¬μ₯λ
1,buyer,γ
γ
γ΄ μΌλ§μμ?
1,seller,μν 0.1g 10λ§μ
π Features
Persona-Driven Generation: 5 distinct personas (3 buyer types, 2 seller types)
Slang Preservation: 120+ drug-related slang terms with natural variations
Pattern Detection: Built-in suspicious pattern detection
Scalable: Generates thousands of conversations efficiently
β οΈ Important Notes
Ethical Usage
This code is designed exclusively for:
Academic research purposes
Law enforcement training data generation
AI safety and detection system development
API Limitations
Expect ~90% API refusal rate due to content sensitivity
Use research-framing prompts for better success rates
Estimated 75,000-150,000 API calls needed for 15,000 dialogues
π Sample Data
See sample_conversations.csv for 50 example generated conversations demonstrating:
Various persona interactions
Authentic slang usage
Realistic transaction flows
Natural conversation patterns