
[ICLR 2026] - Official repo for the paper: "RedBench: A Universal Dataset for Comprehensive Red Teaming of Large Language Models"
A comprehensive framework for evaluating the safety of Large Language Models (LLMs) through systematic attack and refusal testing. RedEval provides a unified, secure, and extensible platform for assessing LLM robustness against adversarial prompts and harmful content. It is a part of the paper "RedBench: A Universal Dataset for Comprehensive Red Teaming of Large Language Models", which is a universal dataset for comprehensive red teaming of LLMs.
📦 Dataset: The RedBench dataset is publicly available on HuggingFace at knoveleng/redbench. It includes comprehensive red teaming prompts across multiple safety categories and domains.
# Clone the repository
git clone https://github.com/knoveleng/redeval.git
cd redeval
# Install dependencies
pip install -r requirements.txt
# Copy and configure environment variables
cp .env.template .env
# Edit .env with your API keys
Edit .env file with your credentials:
OPENAI_API_KEY=your_openai_api_key_here
HUGGINGFACE_TOKEN=your_huggingface_token_here
# Set up environment
source ./sh/setup_env.sh
# Run with default models, you can edit .env to define models which you wanna run
python -m redeval.cli run-pipeline
# Run complete pipeline with specific models
python -m redeval.cli run-pipeline --models "Qwen/Qwen2.5-7B-Instruct" "gpt-4o-mini"
# Or run individual phases
./sh/generate_attack.sh
./sh/run_attack.sh
./sh/eval_attack.sh
RedEval evaluates LLM safety through two complementary approaches:
Tests LLM vulnerability to adversarial prompts using various jailbreaking techniques:
Evaluates LLM's ability to appropriately refuse harmful requests across multiple safety datasets:
Calculates comprehensive safety metrics combining both attack and refusal performance.
redeval/
├── redeval/ # Core Python modules
│ ├── config.py # Environment & configuration management
│ ├── pipeline.py # Centralized pipeline orchestrator
│ ├── cli.py # Unified command-line interface
│ ├── exceptions.py # Custom exception handling
│ ├── generate_attack.py # Attack prompt generation
│ ├── run_attack.py # Attack execution
│ ├── eval_attack.py # Attack evaluation
│ ├── run_refuse.py # Refusal testing
│ ├── eval_refuse.py # Refusal evaluation
│ └── score.py # Metric calculation
├── sh/ # Shell script interfaces
│ ├── setup_env.sh # Environment setup
│ ├── generate_attack.sh # Attack generation script
│ ├── run_attack.sh # Attack execution script
│ ├── eval_attack.sh # Attack evaluation script
│ ├── run_refuse.sh # Refusal testing script
│ ├── eval_refuse.sh # Refusal evaluation script
│ └── score.sh # Scoring script
├── recipes/ # Configuration files
├── logs/ # Evaluation results
└── .env # Environment variables
graph TD
A[Generate Attack Prompts] --> B[Run Attack Tests]
B --> C[Evaluate Attack Results]
D[Run Refuse Tests] --> E[Evaluate Refuse Results]
C --> F[Calculate Final Scores]
E --> F
F --> G[Generate Reports]
Clone Repository
git clone <repository-url>
cd redeval
Install Dependencies
pip install -r requirements.txt
Configure Environment
cp .env.template .env
# Edit .env with your API credentials
Verify Installation
python -m redeval.cli --help
RedEval uses environment variables for secure and flexible configuration:
| Variable | Description | Example |
|---|---|---|
OPENAI_API_KEY | OpenAI API key | sk-proj-... |
HUGGINGFACE_TOKEN | HuggingFace token | hf_... |
| Variable | Description | Default |
|---|---|---|
REDEVAL_PROJECT_ROOT | Project root directory | Current directory |
REDEVAL_LOG_DIR | Logs directory | ./logs |
REDEVAL_RECIPES_DIR | Configuration directory | ./recipes |
REDEVAL_LOG_LEVEL | Logging level | INFO |
REDEVAL_NUM_SAMPLES | Number of evaluation samples | 10 |
REDEVAL_SEED | Random seed | 0 |
| Variable | Description | Default |
|---|---|---|
REDEVAL_OPEN_SOURCE_MODELS | Open-source models list | "Qwen/Qwen2.5-7B-Instruct" |
REDEVAL_CLOSED_SOURCE_MODELS | Closed-source models list | "gpt-4o-mini" |
Configuration files in recipes/ directory control evaluation parameters:
attack/base-open.yml - Open-source model attack configurationattack/base-close.yml - Closed-source model attack configurationattack/eval.yml - Attack evaluation configurationrefuse/base-open.yml - Open-source model refusal configurationrefuse/base-close.yml - Closed-source model refusal configurationrefuse/eval.yml - Refusal evaluation configurationRedEval provides a unified CLI for all operations:
# Run full evaluation pipeline
python -m redeval.cli run-pipeline
# Run with specific models
python -m redeval.cli run-pipeline --models "Qwen/Qwen2.5-7B-Instruct" "gpt-4o-mini"
# Run specific phases only
python -m redeval.cli run-pipeline --phases generate_attack run_attack eval_attack
# Generate attack prompts
python -m redeval.cli generate-attack --config ./recipes/attack/base-close.yml
# Run attack evaluation
python -m redeval.cli run-attack --config ./recipes/attack/base-open.yml --model "Qwen/Qwen2.5-7B-Instruct"
# Evaluate attack results
python -m redeval.cli eval-attack --config ./recipes/attack/eval.yml --log-dir ./logs/attack/HarmBench/direct/model_name
# Run refusal tests
python -m redeval.cli run-refuse --config ./recipes/refuse/base-open.yml --model "Qwen/Qwen2.5-7B-Instruct"
# Evaluate refusal results
python -m redeval.cli eval-refuse --config ./recipes/refuse/eval.yml --log-dir ./logs/refuse/CoCoNot/base/model_name
# Calculate scores
python -m redeval.cli score --log-dir ./logs/attack/HarmBench/direct/model_name --keyword "unsafe"
For users preferring shell scripts: