Constitutional Classifiers: Defending against Universal Jailbreaks across Thousands of Hours of Red Teaming
Paper • 2501.18837 • Published • 10
Reproduction of Sharma et al., "Constitutional Classifiers: Defending against Universal Jailbreaks across Thousands of Hours of Red Teaming" (arXiv:2501.18837), scaled to open weights and a small compute budget.
| Paper | Here | |
|---|---|---|
| Generator / target / judge | Claude | Qwen/Qwen2.5-7B-Instruct |
| Classifier backbone | Claude 3.5 Haiku | Qwen/Qwen2.5-1.5B (base checkpoint, per App. E.4) |
| Harmful seeds | helpful-only model | PKU-Alignment/BeaverTails (public, no uncensored generator) |
| Benign seeds | Claude data | OR-Bench-80k + BeaverTails safe + constitution-conditioned near-boundary Q&A |
| Calibration pools | WildChat, OR-Bench | allenai/WildChat, bench-llm/or-bench (same) |
| Eval proxies | non-infohazardous CBRN analogs | 20 safe dual-use chemistry queries (same substitution) |
| Scale | ~70K+ prompts, big backbones | ~15–20K examples, 1.5B backbone |
Held-out transforms for eval (never in training augmentation): base64, multi-turn roleplay, expert framing. Training augmentation: paraphrase, system-prompt variation, assistant pre-fill, leetspeak, near-boundary generation.
Hyperparameters the paper does not publish (our defaults, flagged in code): λ (NTP regularizer weight) = 0.5, output-classifier LR = 1e-5, epochs = 1, effective batch 32 (companion Anthropic study used 1 epoch, batch 32 — we match that shape).
constitution.yaml — CBRN/chemistry constitution, 6 harmful + 3 harmless bucketsscripts/build_dataset.py — Stage I seeds + Stage II vLLM augmentation, pushes to Hubscripts/train_input_classifier.py — TRL SFTTrainer, prompt/completion +
completion_only_loss=True (single-token NTP verdict)scripts/train_output_classifier.py — custom value head + paper Eq. 1 loss with ω rampscripts/evaluate.py — threshold calibration, red-team eval, rubric judge, guard simulationpython scripts/build_dataset.py --n_harmful 6000 --n_harmless 6000 \
--hub_dataset_id aytsrndl/cc-repro-synthetic
python scripts/train_input_classifier.py --hub_model_id aytsrndl/cc-repro-input-classifier
python scripts/train_output_classifier.py --hub_model_id aytsrndl/cc-repro-output-classifier
python scripts/evaluate.py --input_clf aytsrndl/cc-repro-input-classifier \
--output_clf aytsrndl/cc-repro-output-classifier
Metrics logged to Trackio; all artifacts pushed to the Hub.
@article{sharma2025constitutional,
title={Constitutional Classifiers: Defending against Universal Jailbreaks
across Thousands of Hours of Red Teaming},
author={Sharma, Mrinank and Tong, Mike and Mu, Jacob and Wei, Davis and others},
journal={arXiv preprint arXiv:2501.18837},
year={2025}
}