Skip to content
CentreSecuriteIAPublic

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Repository files navigation

REDACT — Red-team Dataset Automation & Construction Toolkit

Python Version License: MIT Docs Datasets Sister project: BELLS-O

REDACT builds red-teaming datasets for content moderation and jailbreak research. Give it a taxonomy of harm categories and a recipe: it generates samples for every category, checks each one with a second model, generates model responses, augments the samples with jailbreak techniques and natural variations, and merges the accepted rows into one CSV. Every stage saves as it goes and resumes where it stopped. It is for AI safety researchers and engineers who build or evaluate content-moderation filters and jailbreak guardrails, and is built for defensive research. It is developed by CeSIA — Centre pour la Sécurité de l'IA, and grew out of the datasets of its sister project BELLS-O, a benchmark of AI supervision systems.

📖 Full documentation: https://centresecuriteia.github.io/REDACT/

How it works

A run is an ordered list of stages. Each is one function you can also call on its own:

  1. constitution: a strong model writes, per taxonomy category, sample descriptions at four severities: harmful, dual-use harmful, dual-use benign, benign.
  2. inputs: an uncensored model turns each description into prompts, and a checker model accepts or rejects every one.
  3. outputs: one checked model response per accepted input.
  4. paraphrase: checked rewordings of the inputs and outputs, to remove the generating model's fingerprint.
  5. jailbreaks: attacks drawn from 152 techniques in 23 families, dealt evenly across categories, and natural variations of the inputs.
  6. build: the accepted rows of every stage, merged into complete_dataset.csv.

Models are hosted APIs or local vLLM engines, planned onto the GPUs stage by stage. Prompts are JSON files that a run can override one by one. docs/overview.md draws the files each stage reads and writes.

Install

Python 3.11 or later.

git clone https://github.com/CentreSecuriteIA/REDACT.git
cd REDACT
pip install -e .            # hosted models (Venice, Anthropic, OpenRouter)
pip install -e ".[vllm]"    # + local models through vLLM

Put the API keys (VENICE_API_KEY, ANTHROPIC_API_KEY, OPENROUTER_API_KEY) in a .env file at the repository root. The other extras are in docs/running.md.

Quick start

Run the example recipe, all six stages, into ./runs/first:

python scripts/run.py src/redact/configs/runs/training_example.json --data-dir ./runs/first

The merged dataset lands in ./runs/first/Datasets/complete_dataset.csv. The paraphrase stage loads a 24B model on a local GPU; take it out of the recipe's stages to run on hosted models only.

Or call a stage from Python:

from redact import generate_constitution, generate_inputs

constitution = generate_constitution(data_dir="./runs/first", num_taxonomy_categories=3)
inputs = generate_inputs(data_dir="./runs/first", constitution_df=constitution, samples_per_entry=3)

Documentation

Published datasets

Datasets REDACT has produced, on Hugging Face under centrepourlasecuriteia. Access is granted on request, on each dataset's page.

License

MIT License. See LICENSE.

About

No description, website, or topics provided.

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages