Constitutional safety harness and red-team range
Wrap a target LLM app in layered safety (sanitize, rails, classifiers, output filter, human review), attack it with six attack families, and measure a constitutional self-critique harmlessness delta.
The capstone and what it builds on
- 1Constitutional Safety Harness + Red-Team RangeThe capstone brief
- 2Constitutional AI and RLAIFPhase 18: Ethics, safety and alignment
- 3Red-Teaming: PAIR and Automated AttacksPhase 18: Ethics, safety and alignment
- 4Many-Shot JailbreakingPhase 18: Ethics, safety and alignment
- 5ASCII Art and Visual JailbreaksPhase 18: Ethics, safety and alignment
- 6Red-Team Tooling - Garak, Llama Guard, PyRITPhase 18: Ethics, safety and alignment
- 7Moderation Systems - OpenAI, Perspective, Llama GuardPhase 18: Ethics, safety and alignment
- 8Guardrails, Safety & Content FilteringPhase 11: LLM engineering and RAG
- 9Llama Guard and Input/Output ClassificationPhase 15: Autonomous systems
What You'll Build
A layered safety harness around a target application plus an automated red-team range. Requests pass input sanitisation, policy rails and classifier gates; outputs pass a classifier, PII scrub and a human-review tier. A scheduler runs six attack families against the target, findings are CVSS-scored, over-refusal is tracked on a benign set, and a constitutional critique-and-revise run produces a before and after harmlessness number.
Requirements
- Target app: a small instruction-tuned model you serve, or a chatbot from another capstone.
- Five layers, each emitting its own span or log line: input sanitize (zero-width characters, base64 and rot13 decoding, Unicode normalisation), policy rails (NeMo Guardrails or your own rules for off-domain, toxicity and PII extraction), classifier gate (an open safety classifier on input, plus a multilingual check), output filter (classifier plus PII scrub) and a human-review queue for high-risk outputs.
- Baseline each classifier on a small labelled set and report precision and recall.
- Red-team scheduler running at least six attack families: PAIR-style automated jailbreak, TAP-style tree attack, encoding attacks (ASCII, base64, rot13), multi-turn persona, multilingual code-switch, and GCG suffix attacks (or many-shot jailbreaking if you have no GPU). Use garak, PyRIT, promptfoo or your own drivers. Report success rate per family with and without the harness.
- At least two languages covered in the attack suite.
- Over-refusal: pass rate on a benign suite such as XSTest, with and without the harness.
- Constitutional self-critique: draft responses to harmful-attempt prompts, critique them against a written constitution, revise, then fine-tune (LoRA SFT) on the improved pairs; measure harmlessness before and after on a held-out set.
- CVSS 4.0 scoring for each successful attack, with a disclosure timeline and mitigation plan.
- Automation: the whole range runs from a scheduler (cron, GitHub Actions or similar), findings go to a queue or file, and an over-refusal regression triggers an alert.
Constraints
- Model-agnostic: any OpenAI-compatible endpoint (including the KatalockAi API) or a local model (for example via Ollama, llama.cpp or vLLM) may be used. No named commercial model is required; record which model you used in the README. The target and judges can be the same small open model or different ones.
- Hardware: inference-only parts run on a laptop. GCG and the LoRA step need a GPU (a free Colab T4 is enough for a 0.5B to 1.5B model).
- Substitution: the lesson uses 1k prompts and an 8B target. Here 200 or more harmful-attempt prompts from public benchmark sets (for example HarmBench, AdvBench or JailbreakBench) are accepted. If you cannot fine-tune, you may measure an inference-time critique-and-revise loop instead and must say so in the README; GCG may be replaced by many-shot jailbreaking without a GPU.
- Responsible handling: do not commit successful harmful completions. Store prompts, labels and pass or fail outcomes, and redact outputs.
Stretch Goals
- Add indirect prompt injection via retrieved documents as a seventh family.
- Add a refuse-with-help mode and measure its effect on XSTest.
- Find a language where the multilingual check underperforms and propose a fix dataset.
How to Submit
- Public GitHub repo with
harness/(layers),classifiers/,redteam/(drivers, schedules, findings),constitution/(rules, critique loop, training config),eval/(held-out and benign results),findings/(CVSS-scored, redacted) andREADME.md. - README: target choice, layer diagram, how to run the range once and on schedule, attack-family table, over-refusal numbers, constitution and delta, disclosure process and limitations.
- Paste the per-family success table (with and without harness), the over-refusal comparison, the before and after harmlessness numbers and one redacted CVSS finding.
How It's Reviewed
Professor Katalock reads your repository and the evidence you paste, and scores each criterion out of 100. You pass with a weighted total of 70 or more and no criterion below 40. A copied or padded submission is flagged and fails.
Submit
Push your work to a public GitHub repository with a README that explains how to run it, then paste the evidence below. Up to 3 reviews a day, free.
- Per-family attack success table with and without the harness
- Over-refusal comparison on the benign set
- Before and after harmlessness numbers from the constitution run
- One redacted CVSS-scored finding with timeline
- Scheduler run log showing an automated range execution
Reviews are done by AI against the rubric above. They check the evidence in your repository; they are not a substitute for a human code review, and a review can be wrong. If you think it is, improve the README so the evidence is unmistakable and resubmit.