14  Recipe: use the standardized jailbreak benchmark corpus

Field Value
Tool llm-jailbreak-bench
Section Scanning
Level medium
Time ~10 min install + run time
Layer/Category ATTACK / a-02-prompt-injection-jailbreaks (data pack)
Tags scan, llm01, benchmark, corpus, data-pack, llm-jailbreak-bench

14.1 Problem

Ad-hoc jailbreak runs compare nothing. To state “this model got more robust”, the runs need the same 100 behaviours every time. The runs need the same query protocols. The runs need the same refusal judges. The runs need the same artifact format every time. The standardized answer is JailbreakBench (JBB) — an open robustness benchmark. JBB carries a frozen behaviour dataset, a query/judging harness, and a leaderboard artifact format. The Kailash catalogue ships it as the llm-jailbreak-bench row. The row is a data pack: the pinned harness + metadata, not a command wrapper.

14.2 Solution

The row is packaging: data, safety: safe. The pack delivers the harness source + metadata at a frozen tag into the system. Drive it through its own Python API (verified against the pinned source at tag v1.0.0). Install and inspect:

# 1. See the pack's row (data row; rides the data-pack opt-in path)
kailash info llm-jailbreak-bench

# 2. Opt in — data packs are deliberate derivations, never a default
#    profile member; land it like any package output:
nix build github:kailash-os/kailash-packages#llm-jailbreak-bench -o result
ls result/share/kailash/data/llm-jailbreak-bench/
#    -> the pinned repo tree (src/jailbreakbench/..., README, LICENSE)

# 3. The pinned harness exposes its dataset through the API
#    (the behaviours live on HuggingFace and load at harness runtime):
#    read_dataset(split="harmful") -> goals / targets / behaviors /
#    categories / sources for the 100-behaviour JBB-Behaviors set

Work the harness in Python (shapes verified in the pinned README + src/jailbreakbench/ at the pin):

import jailbreakbench as jbb

# 1. The standardized behaviour set (100 harmful / 100 benign):
d = jbb.read_dataset(split="harmful")
print(d.behaviors[0], d.categories[0])

# 2. Load an attack-method/model pair to compare against:
llm = jbb.LLMLiteLLM(model_name="<model>", api_key="<key>")   # API path
llm = jbb.LLMvLLM(model_name="<model>")                       # local path

# 3. Query the target (optionally with a defence in play):
responses = llm.query(prompts=["<prompt>"], behavior="<behavior>",
                      defense="SmoothLLM")

# 4. Read published artifacts for the same method/model pair:
artifact = jbb.read_artifact(method="PAIR", model_name="<model>")
print(artifact.jailbreaks[<index>])   # goal/prompt/response/
                                      # queries_to_jailbreak/jailbroken

Expected output shape (abridged):

>>> d.behaviors[<i>], d.categories[<i>]
<Behavior string> <Misuse category>

>>> artifact.jailbreaks[<i>]
JailbreakInfo(
    index=<i>,
    goal='<goal>',
    behavior='<behavior>',
    category='<category>',
    prompt='<jailbreak prompt>',
    response='<target-model reply>',
    number_of_queries=<n>, queries_to_jailbreak=<n>,
    prompt_tokens=<n>, response_tokens=<n>,
    jailbroken=<True/False>,
)

14.3 Discussion

  • Why a data-pack row, and what the row IS: the pack passthrough installs the pinned upstream repo: harness, corpus loaders, repo metadata. The pin is tag v1.0.0 (commit 518a41a8, sha256-pinned, NO auto-update). It installs into share/kailash/data/llm-jailbreak-bench. The behaviour corpus is NOT vendored in the pack. The pinned dataset.py loads it from HuggingFace (JBB-Behaviors) at harness runtime. The “harness + artifact pack” description names exactly this surface. The row is the routing record. The harness is the invocation surface.
  • The corpus licence caveat — the data-row pattern in full: the repo licence is MIT (verified at the pin). The MIT licence covers the harness code. It does not by itself establish every downstream content licence. The JBB-Behaviors dataset carries its own terms. The published jailbreak artifacts are model outputs. The manifest’s other data rows state this boundary explicitly (the wordlist packs’ “per-file corpus content licences beyond the repo licence are NOT established”). Refresh wordlists and data packs carries the general pattern. Treat corpus content the same way. Check each redistributed item before the redistribution.
  • The 400-call guard: the benchmark’s query protocol logs every LLM interaction. Its API paths need real provider keys (TOGETHER_API_KEY / OPENAI_API_KEY per the pinned README). Keys live in the ~/.config/kailash/keys/ posture per the OS secrets policy, never in the store. Judge models (Llama3RefusalJudge class exports at the pin) also cost calls. Scope the run accordingly.
  • The same-standard bridge: the harness’s method/model artifact grid is the diff target. Run the attack method over the same 100 behaviours. Compare jailbroken fractions. Where Kailash’s standards view cares: the D-7 lane renders the OWASP LLM Top-10 evidence matrices. The D-7 registry record is OS#210 (https://github.com/kailash-os/kailash-os/issues/210 — the pre-#10 standards-toolkit row was phantom-upstream, removed). Jailbreak robustness maps onto LLM01 in this tool’s manifest row (both epochs). The recipe tags carry the mapping for the Top-10 collection views.
  • Pipeline pair: PyRIT’s scriptable attack execution is the natural driver when the method needs multi-turn dynamics. Run the strategy, and submit per-behaviour outcomes to the JBB artifact shape. See Automate an attack pipeline with PyRIT. The garak scanner (the garak full-baseline walkthrough) stays the broad-probe alternative.
  • vLLM extras note: local model loading needs the harness’s vLLM extra (pip install jailbreakbench[vllm] upstream). On Kailash, use the manifest’s ollama/vLLM serving lanes (Serve a local model for scanning), or use the API path. The pinned pack is the harness + metadata either way.

14.4 See also


Recipe provenance. Verified against the pinned upstream source JailbreakBench/jailbreakbench at tag v1.0.0 (commit 518a41a8, committer date 2024-06-13): pyproject.toml (project name/version, deps, the vllm extra), src/jailbreakbench/dataset.py (read_dataset(split=...), the HF-backed JailbreakbenchDataset attributes), src/jailbreakbench/__init__.py (exports: LLM, LLMLiteLLM, LLMvLLM, Classifier, Llama3JailbreakJudge, Llama3RefusalJudge, evaluate_prompts, create_submission, read_artifact, read_dataset, StringClassifier), and README.md (the LLMLiteLLM/LLMvLLM/query(prompts, behavior[, defense]) shapes and the JailbreakInfo artifact shape) — fetched raw at the pin, verified 2026-10-14. The HF account at the pin is dedeswim/JBB-Behaviors (now redirecting to JailbreakBench/JBB-Behaviors); the README links the canonical dataset home. Manifest facts (ATTACK/a-02; MIT; packaging data; safety safe; AML.T0054/T0042; owasp_llm {2026: [LLM01], v2: [LLM01]}) read from the packages manifest at main; derivation facts (passthrough install to share/kailash/data/llm-jailbreak-bench, sha256-pinned FOD, no auto-update) read from pkgs/llm-jailbreak-bench/default.nix at pin 138a457. Smoke status: the pack build is unattended packaging (no smoke gate beyond the fetch); a hands-on harness loop against a live provider: PENDING (follow-up on kailash-os#104).