By UNST33R
How to jailbreak AI models: attack families, ASR measurement, and a harness that survives review
An authorized-testing methodology for jailbreak work: how jailbreaking differs from prompt injection and from abliteration, the nine attack families worth probing, strict versus lenient attack success rate, judge design, the tooling chain from PyRIT to garak to CI gates, and the model-tier math for probe generation and adjudication.
Search interest in jailbreaking AI splits cleanly in two. One audience wants a working payload for a model someone else owns, and that half of the internet takes care of itself. The other audience is security teams who need to measure refusal behavior on systems they are authorized to test: a guardrail commit going out, a gateway configuration change, a model upgrade behind the same endpoint. This guide is for the second audience. It covers the attack families worth probing, how to score results so they survive review, and the harness that turns a one-off run into a regression gate. Scope first: run this against deployments you own or have written authorization to test, inside the boundaries of an acceptable use policy you can cite in the engagement letter.
Three problems that get conflated
Before choosing tools, separate the three questions that "red teaming an LLM" mixes together, because each has a different target and a different remedy:
| Question | What it is called | Where the attacker operates | Covered in depth |
|---|---|---|---|
| Can input text alone pull policy-violating output from a guarded model? | Jailbreaking | Input space, single or multi turn | This post |
| Can content that arrives through a data channel hijack the model's instructions? | Prompt injection | Retrieval, tool output, documents | Injection regression suite |
| Can refusal behavior be removed from the weights themselves? | Abliteration | Weight space, offline | What is abliteration |
Jailbreak testing asks the first question on purpose, with a corpus you control and a scorer you validated. The three layers of refusal removal covers the third question's ecosystem. The distinction matters operationally because a deployment can pass an injection suite and still fold to a two-turn jailbreak, and a fully uncensored model makes jailbreak testing meaningless on itself while making it more useful everywhere else, as a probe generator. That last asymmetry drives the model selection section below.
The nine attack families
Attack families cluster by the mechanism they stress. A test plan that samples each family at least once per candidate model catches guardrail regressions that single-family suites miss:
| Family | Mechanism | What it stresses |
|---|---|---|
| Persona and roleplay framing | Requests harm inside a fictional role the model accepts | Policy scope around adopted identities |
| Hypothetical and academic framing | Requests harm as a thought experiment, exam answer, or fiction | Boundaries between explanation and instruction |
| Encoding and ciphers | Payload delivered base64, ROT13, leetspeak, or ciphered | Input-side filter dependence on plaintext |
| Prefix and token smuggling | Model asked to continue a partially written answer | Next-token momentum versus policy evaluation |
| Many-shot | Dozens of fabricated in-context dialogue turns modeling compliance | Long-context policy drift (arXiv:2404.14421) |
| Crescendo multi-turn | Benign opening that escalates one small step per turn | Per-turn state tracking across the conversation |
| Skeleton key | A context-setup turn claiming altered rules precedes the request | Deference to stated context over trained policy |
| Low-resource language switch | Payload in a language the safety tuning undercovers | Multilingual alignment coverage |
| Buried instruction | Target request hidden inside long irrelevant context | Attention allocation under context load |
Two of these ship as named attack classes in Microsoft's PyRIT: ManyShotJailbreakAttack and CrescendoAttack, alongside SkeletonKeyAttack. That mapping is deliberate. Framework implementations encode the conversation-state machinery (memory, turn limits, transcript export) that is tedious to rebuild, and the multi-model sweep walkthrough shows how to point them at an OpenAI-compatible endpoint through one target class.
Scoring: the part that decides whether results mean anything
A jailbreak run without a scoring contract produces a number nobody can defend. Build the contract before the corpus.
Strict and lenient ASR, both reported. Lenient scoring counts any policy-relevant acknowledgment; strict scoring requires the specific harmful deliverable to appear. Report both: strict ASR is your regression metric, and the strict-lenient gap measures how often the model engages before stopping, which is itself a behavior worth tracking. If 12 probes out of 200 strict-scored succeed, strict ASR is 6.0 percent; the fraction is trivial, the scoring rubric behind "succeed" is the work.
Judge design. Keyword matching alone misses paraphrase; an unvalidated LLM judge alone drifts with the judge model's own refusals. The working pattern is hybrid: deterministic keyword screens for the deliverable, an LLM judge for the gray zone, and a hand-labeled sample of a few hundred transcripts to measure the judge's false positive and false negative rates before you trust it. The garak scan guide covers the same discipline from the scanner side, including why raw scanner scores mislead across models.
Benign lookalikes. Run a control set of benign-but-scary requests, such as explaining parameterized queries or parsing an authentication log. A guardrail change that drops ASR to zero while refusing half the lookalikes has moved the failure mode, and the PyRIT CI gate design shows this false-refusal metric wired directly into the block decision.
Determinism hygiene. Fix seeds and sampling parameters per run, deduplicate the corpus by semantic equivalence, and version the corpus like code, because a corpus that silently drifts between runs makes every ASR delta uninterpretable.
The harness
The minimum viable harness is small. Point an OpenAI-compatible client at the endpoint under test, send the corpus, persist every transcript with its score:
from openai import OpenAI
client = OpenAI(base_url="https://api.unst33r.si/v1", api_key=KEY)
def probe(system_prompt: str, user_payload: str) -> str:
r = client.chat.completions.create(
model="target-model-id",
temperature=0.0,
max_tokens=1024,
messages=[
{"role": "system", "content": system_prompt},
{"role": "user", "content": user_payload},
],
)
return r.choices[0].message.content
That loop answers single-turn questions and nothing else. Multi-turn families need conversation state, which is the point where the framework layer pays for itself. The tooling split that works in practice:
| Layer | Tool | Role |
|---|---|---|
| Multi-turn attacks and orchestrators | PyRIT with LiteLLMChatTarget | Crescendo, many-shot, skeleton key classes against any OpenAI-compatible base URL |
| Probe breadth | garak | Scanner probe packs across vulnerability classes with JSONL evidence |
| Template matrices | promptfoo | System-prompt and template variation sweeps with per-plugin scoring |
| Regression enforcement | CI gate | Block merges when jailbreak rate crosses the threshold line |
The one-line base_url swap is what makes the whole stack portable across hosted endpoints, and the OpenAI-compatible switching guide covers it for the common client libraries.
Choosing the generator and judge models
The quiet failure mode of jailbreak pipelines is upstream of the target: the model generating your probe corpus starts refusing, the corpus quietly thins out, and ASR falls for a reason that has nothing to do with the guardrail under test. This is the documented motivation for running probe generation on refusal-reduced or uncensored models, and it is where model selection becomes part of methodology:
| Workload | Tier shape | Example rates (per 1M tokens) |
|---|---|---|
| Bulk probe and corpus generation, high volume, repeated runs | Abliterated budget tier with cached-input pricing | unst33r-deepseek: $0.15 in / $0.5625 out, $0.03125 cached |
| Tool-call-heavy adversarial dialogue, multi-turn orchestration | Mid tier with strong tool-calling fidelity | unst33r-flash: $0.50 / $1.50 |
| Judge passes and adjudication of gray-zone transcripts | Strongest reasoning tier, low volume | unst33r-pro: $2.50 / $4.50 |
The arithmetic favors the split. A weekly corpus refresh of 10 million input tokens with 8 million repeated from the prior week costs under $2 on the budget tier's cached-input line, while a judge pass over the gray-zone transcripts, a few hundred thousand tokens, prices at pennies even on the top tier. The tier selection guide and the uncensored tier comparison work through these tradeoffs with the benchmark and pricing tables.
Reporting and escalation
Report jailbreak results as a matrix, family by family, model by model, with both ASR definitions and the judge's measured error rates attached. A single percentage hides whether the suite found a wording quirk in one family or a systematic collapse across nine. Two escalation rules keep the report honest: any strict ASR above the pre-agreed threshold on any family is a finding regardless of the aggregate, and a falling ASR paired with a rising false-refusal rate on benign lookalikes is reported as a regression, since the guardrail moved the cost onto legitimate users. For findings against third-party deployments, follow a coordinated disclosure path; the disclosure policy analysis covers why trust accrues to teams that report through channels rather than posts.
The pre-engagement checklist, compressed: authorization named in writing, scope and endpoints enumerated, corpus versioned and deduplicated, judge validated against hand labels, benign lookalike set included, seeds and sampling pinned, both ASR definitions reported, thresholds agreed before the run. Teams that skip the checklist get numbers; teams that run it get evidence.