GO TO A SECTION

↑ ↓ to navigate · Enter to openExplore all sections →
FDEInterviews logo
arXiv preprint

HarmBench: A Standardized Evaluation Framework for Automated Red Teaming and Robust Refusal

Jailbreak papers reported numbers nobody could compare. HarmBench fixed the behaviors, the length and the judge, ran 18 attacks on 33 models, and found no attack or defense that wins everywhere.

Breakdown by FDE Interviews · 11 min read · Updated

About the original · 2024
AUTHORS
Mazeika, Phan, Yin, Zou, et al.
FROM
University of Illinois Urbana-Champaign, Center for AI Safety, Carnegie Mellon University, UC Berkeley, Microsoft
PUBLISHED
Feb 2024 · arXiv preprint
IN THIS BREAKDOWN · 10 SECTIONS

You can read 18% of this breakdown.

01

The paper in one minute

By early 2024 there were many automated red-teaming methods, each reporting impressive attack success rates. The numbers couldn't be compared: papers used different harmful behaviors (several with fewer than 100 unique ones), different generation lengths, and different success judges, sometimes the same judge their attack had optimized against.

HarmBench standardizes all three. It has 510 harmful behaviors written against the usage policies of major model providers and filtered to avoid dual-use requests that most people would want answered. They come in four functional categories: 200 standard, 100 copyright, 100 contextual (a request about a supplied document) and 110 multimodal (a request about an image). An official validation set of 100 and test set of 410 must not be tuned on.

The pipeline is fixed: an attack writes test cases, the model (with any defense) answers with greedy decoding for 512 tokens, and a held-out classifier decides success. For text, it's a Llama 2 13B fine-tuned to match GPT-4 judgments, which agreed with human labels 93.2% of the time and passed tests designed to fool weaker judges. Copyright success uses a hashing check for actual reproduced text.

Running 18 attacks against 33 models (24 open, 9 closed) gave two findings. No attack or defense is uniformly effective: every attack failed on some model and every model fell to some attack. And robustness is independent of size: within six model families from 7B to 70B, bigger wasn't safer, while families differed a lot. The authors also introduce R2D2, adversarial training against a continually updated pool of GCG attacks, which made a Mistral 7B base the most robust model against GCG.

THE IDEA, VISUALLY
STANDARDIZED PIPELINE (FIGURE 3) Behaviors 510, fixed val/test Attack writes test cases Model + defense greedy, 512 tokens Classifier held out attack success rate FUNCTIONAL CATEGORIES standard 200 copyright 100 contextual 100 multimodal 110 7 semantic categories, e.g. cybercrime, chem/bio, misinformation WHAT MAKES RESULTS COMPARABLE (SECTION 3.2) Fix the generation length: it moved ASR by up to 30%. Hold the classifier out: scoring on the metric an attack optimized lets it game the number. Contextual behaviors can't be looked up: 0 of 20 found by search, vs 50% (AdvBench) and 55% (MaliciousInstruct). AGREEMENT WITH HUMAN LABELS (TABLE 3) AdvBench substring 69.9% Llama-Guard 66.9% GPT-4 judge (PAIR) 88.4% HarmBench classifier 93.2% axis starts at 50% 18 ATTACKS x 33 MODELS (SECTION 6.1) No attack broke every model; no model resisted every attack. Robustness did not grow with size within a family (7B to 70B); training data and method mattered more. R2D2 ADVERSARIAL TRAINING (SECTION 6.2) GCG attack success Llama 2 7B Chat 31.8% Llama 2 13B Chat 30.2% Zephyr 7B + R2D2 5.9% MT-Bench 6.0 vs 6.5 for Mistral 7B Instruct v0.2; 16 hours on 8 A100s; weaker gains on attacks unlike GCG (PAIR, TAP, few-shot).
Fixed behaviors, fixed decoding, a held-out judge: the pipeline that made 18 attacks and 33 models comparable for the first time.
Research notes: the problem, approach and results
18 × 33

red-teaming methods by models and defenses compared under one pipeline

up to 30%

change in attack success from the number of generated tokens alone, a setting prior papers didn't fix

5.9%

GCG attack success on Zephyr 7B + R2D2, against 31.8% for Llama 2 7B Chat; its MT-Bench comparison uses Mistral 7B Instruct instead

THE PROBLEM

Automated red-teaming papers each used their own behaviors, decoding lengths and success judges, often the same metric their attack optimized, so their numbers couldn't be compared.

THE IDEA

A benchmark with 510 curated harmful behaviors in four functional categories, an official validation/test split, greedy decoding to a fixed 512 tokens, and a held-out fine-tuned classifier that passes robustness checks; plus R2D2, an efficient adversarial-training baseline.

THE RESULT

Across 18 red-teaming methods and 33 models, no attack broke every model, no model resisted every attack, and robustness didn't grow with model size. R2D2 cut GCG attack success to 5.9%, against 31.8% for Llama 2 7B Chat.

02

Why it matters to an FDE

A customer will eventually ask you whether their model or guardrail is safe enough, or show you a vendor's attack-success number. HarmBench is the reference for what a credible number requires.

Pin the protocol. Decoding settings, how many tokens are generated and which judge decides success change the answer as much as the model does. A number without those is not comparable with anything.

Keep the judge independent. An attack or defense tuned against a metric will look good on that metric. Use a judge that wasn't part of the optimization, and check it against cases built to fool it.

Test the behaviors your product must refuse. HarmBench covers content safety. A deployment also needs application-specific cases (data access, actions, confidentiality, resource use) built with the same discipline: versioned behaviors, fixed scoring, results kept per release.

THE FULL BREAKDOWN

Understand the mechanism. Try it on a real problem.

Unlock this breakdown and 157 more papers.

Premium opens every paper in full, plus every answer, concept, course and guide on the site. One payment for six months of access.

6 months · One payment · No auto-renewal

Get Premium · ₹2,000 / $25
  • ◇1 architecture diagram
  • </>1 runnable code experiment
  • ▦2 results tables
  • ?5 interview questions with answers
  1. 03Key takeaways

    Breadth, comparability, robust metrics, the judge tests, two findings, R2D2, three misreadings

    Free account
  2. 04How it works

    Behavior curation, the success criteria, the classifier's distillation, the pipeline and R2D2

    Premium
  3. 05The numbers that matter

    Dataset composition, judge accuracy, R2D2's settings and results, and the paper's own slips

    Premium
  4. 06Try it yourself

    Recheck the judge tables, then see how generation length and an un-held-out judge move ASR

    Premium
  5. 07Where it breaks

    Content safety only, greedy single-turn tests, judge dependence, fixed attacks and slips

    Premium
  6. 08Using it on a deployment

    Building an application safety suite on HarmBench's rules, and running it on every release

    Premium
  7. 09Interview angles

    Five questions this paper prepares you for, with answer hints

    Premium
Back to the paper library →