CoolFace
Apppublic

jayhyeon83/data_augmentation

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes
App README

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

bash
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