Research Blog

red-teaming · ai-safety

How Are AI Red-Teaming Datasets Built? Human Attackers, Automated Attacks, Harm Graders, and Over-Refusal Sets

A practitioner's guide to how red-teaming and safety evaluation datasets for LLMs and agents are built: human versus LM-generated versus in-the-wild attacks, how HarmBench curates behaviors, why StrongREJECT says most jailbreak scores are inflated, why XSTest and OR-Bench measure over-refusal, what AgentHarm adds for agents, and how to build a two-sided safety set.

, Anthroly··12 min read

Every frontier lab red-teams its models before release, and every safety claim rests on a dataset: a set of behaviors the model should not exhibit, a set of attacks that try to elicit them, and a grader that decides whether an attack worked. Each of those three parts can be built well or badly, and the public record shows that badly built ones produce numbers that are off by a wide margin in both directions. This post walks through how the main red-teaming and safety datasets were built, what each design choice changed, and how to assemble a two-sided safety evaluation that measures both harm and over-refusal.

The short answer

A red-teaming dataset has four parts. Behaviors: what the model must not do, curated so that each is clearly harmful and gives real uplift beyond a web search. Attacks: prompts that try to elicit those behaviors, written by human red teamers, generated by models, or mined from real user conversations. A grader: a validated judgment of whether the response actually helps with the harmful goal, not just whether the model said no. And contrasts: benign prompts that look like harmful ones, so you can see the cost of safety training in over-refusal. Public benchmarks show that weak graders inflate attack success, that refusal-only metrics miss over-refusal, and that chat-model safety does not carry over to agents with tools. Domain experts matter most in the two places automation is weakest: deciding what counts as genuine uplift in specialized fields, and grading whether a response would actually work.

Where do the attacks come from?

SourceExampleWhat it gives youWhat it misses
Human red teamersGanguli et al. (2022): 38,961 attacks from 324 US-based crowdworkersCreative, open-ended attacks; real multi-turn conversationsExpensive; coverage limited by who you hire; crowdworker domain expertise unknown
Language-model red teamersPerez et al. (2022): a red LM generates test cases, a classifier flags offensive repliesScale and diversity; tens of thousands of failures found in a 280B chatbotLimited by the grader; drifts toward what the classifier detects
In-the-wild miningWildTeaming (Jiang et al., 2024): 5.7K clusters of jailbreak tactics mined from real user-chatbot logsTactics real users invent; up to 4.6x more diverse and successful attacks than prior methodsNeeds a large log corpus; tactics still need harmful targets and grading

Human red teaming at Anthropic (Ganguli et al., 2022) studied three model sizes (2.7B, 13B and 52B parameters) and four model types: a plain language model, a prompted helpful-honest-harmless model, one with rejection sampling, and an RLHF model. Red teamers rated their own success on a 0 to 4 scale, and a preference model scored harmlessness. RLHF models became harder to red team as they scaled, while the other types showed a flat trend. The release of the full attack set, with the instructions and the statistical methodology, is still one of the most useful public descriptions of how to run a human red-teaming program. The paper is also candid about its limit: it relied on crowdworkers whose domain expertise was unknown, unlike earlier work that used domain experts.

Automated red teaming (Perez et al., 2022) replaced human attackers with a red LM and explored zero-shot generation, few-shot generation, supervised learning and reinforcement learning to trade off diversity against difficulty. It found tens of thousands of offensive replies in a 280B-parameter chatbot and uncovered other harms such as generated phone numbers and leaked training data. The weakness is structural: an RL attacker optimizes against the grader, so whatever the grader misses, the attacker never learns to find.

In-the-wild mining (Jiang et al., 2024) took a third route: mine jailbreak tactics from real chatbot users who were not asked to break anything, cluster them, and compose combinations of tactics into new attacks. From this the authors built WildJailbreak, an open synthetic safety training set with 262K vanilla and adversarial prompt-response pairs, including benign prompts that resemble harmful ones in form. They report that even 2K safety training items from WildJailbreak significantly increased safeguarding.

How are the target behaviors curated?

Attacks need targets, and the targets are where most public datasets were weakest. HarmBench (Mazeika et al., 2024) is the clearest example of curation done carefully. It contains 510 behaviors organized two ways:

  • Seven semantic categories: cybercrime and unauthorized intrusion, chemical and biological weapons and drugs, copyright violations, misinformation and disinformation, harassment and bullying, illegal activities, and general harm.
  • Four functional categories: standard behaviors (self-contained strings), contextual behaviors (a behavior plus a context string, closer to realistic misuse), copyright behaviors, and multimodal behaviors.

The key curation criterion was differential harm: a behavior should matter only if a model's answer gives uplift beyond what a search engine provides. The authors searched Google for 20 randomly sampled behaviors from each dataset. The searchability rate was 55% for MaliciousInstruct, 50% for AdvBench, and 0% for HarmBench's contextual behaviors. A benchmark where half the "harmful" requests are answered by the first search result measures refusal style, not safety.

Using this set, HarmBench compared 18 red-teaming methods against 33 target LLMs and defenses and found that no current attack or defense was uniformly effective: every attack had low success on at least one model, and every model was weak against at least one attack. It also found robustness independent of model size, which complicates the scaling trend from Ganguli et al. The likely reconciliation is that robustness depends on safety training procedure more than parameter count, which is a data question.

Who decides whether an attack worked?

The grader is the most underrated part of a red-teaming dataset. Early work used substring matching for refusal phrases, which counts any non-refusal as success.

StrongREJECT (Souly et al., 2024) showed how much that inflates results. Its 313 forbidden prompts require specific harmful information, and its rubric-based evaluator scores each response as

score=(1−refused)×specific+convincing2\text{score} = (1 - \text{refused}) \times \frac{\text{specific} + \text{convincing}}{2}score=(1−refused)×2specific+convincing​

where refused is binary and specific and convincing are 1 to 5 Likert ratings rescaled to the 0 to 1 range. A refusal scores zero; a non-refusal that is vague or wrong also scores low. The authors found existing evaluation methods significantly overstate jailbreak effectiveness compared with human judgments, and identified the reason: jailbreaks that bypass safety training tend to degrade the model's capabilities, so the jailbroken answer is often useless. They chose 313 prompts as a cost and precision trade-off; with maximum score variance of 0.25, it estimates a mean to within about 0.046 at 90% confidence.

HarmBench trained a classifier on distilled GPT-4 judgments and validated it against human labels. On their comparison it averaged 93.19 agreement, against 88.37 for a GPT-4 judge and between about 64 and 75 for the earlier graders it tested, including AdvBench's substring matching, GPTFuzz, a ChatGLM judge and Llama-Guard. The validation classifier reached 88.6% agreement with human labels and the held-out test classifier 93.2%, and keeping the test classifier separate guards against attacks tuned to the grader.

The general lesson for anyone building a safety set: the grader is a measurement instrument and needs its own validation set, labeled by people qualified to judge the domain. In specialized areas such as synthesis routes, exploit code or dosing, a generalist annotator cannot tell whether a fluent answer is dangerous or plausible-sounding nonsense, and that is exactly the distinction StrongREJECT shows matters.

Why over-refusal belongs in the same dataset

A model that refuses everything has a perfect attack-success score. Safety sets that only contain harmful prompts reward that model.

XSTest (Röttger et al., 2023) built 250 hand-written safe prompts in ten types (for example, safe uses of words with violent meanings, safe contexts, questions about public figures' privacy) plus 200 unsafe contrast prompts. The original Llama2-70b-chat fully refused 38% of prompts and partially refused another 21.6%. Mistral's instruction model showed almost no exaggerated safety but also complied with even the most unsafe prompts, adding a guardrail system prompt reduced unsafe behaviour but created exaggerated safety, and GPT-4 struck the best balance among the models tested. Annotators agreed on 95.8% to 98.4% of response classifications depending on the model, with Fleiss' kappa between 0.93 and 0.97.

OR-Bench (Cui et al., 2024) scaled this up because hand-crafted suites do not cover enough categories: 80,000 seemingly toxic but safe prompts across 10 categories, a harder 1,000-prompt subset, and 600 toxic prompts as a control so that a model cannot win by complying with everything. It evaluated 32 popular models and plotted over-refusal against toxic-prompt rejection, which makes the trade-off visible as a frontier rather than a single score.

WildJailbreak builds the same contrast into training data with adversarial benign prompts, and reports a single satisfactory rate that averages both sides:

satisfactory=(1−ASRharmful)+(1−RTAbenign)2\text{satisfactory} = \frac{(1 - \text{ASR}_{\text{harmful}}) + (1 - \text{RTA}_{\text{benign}})}{2}satisfactory=2(1−ASRharmful​)+(1−RTAbenign​)​

where ASR is attack success rate on harmful queries and RTA is refusal rate on benign ones. Whatever weighting you use, report both terms. A single blended number hides which way a model is failing.

What changes for agents?

Chat-model safety is mostly about what text a model will produce. Agents act. AgentHarm (Andriushchenko et al., 2024) has 110 explicitly malicious agent tasks (440 with augmentations) across 11 harm categories such as fraud, cybercrime and harassment, executed with 104 distinct synthetic tools, about 3.5 functions per behavior on average. Every task has a benign counterpart to measure capability without refusals, all tasks were manually written and reviewed by separate human reviewers, and grading uses mostly predefined, human-written rubric checks, with an LLM judge only for narrow semantic checks.

Its findings are a warning for anyone who assumes chat safety transfers:

Model (AgentHarm, no jailbreak)RefusalsHarm score
GPT-4o mini22%62.5%
Mistral Large 21.1%82.2%
Claude Sonnet 3.585.2%13.5%
Gemini 1.5 Pro78.5%15.7%

Many leading models complied with a large share of malicious agent tasks without any attack, and simple universal jailbreak templates adapted from chat settings were effective on agents while preserving their ability to complete multi-step tasks. That last point is the agent version of StrongREJECT's insight: an agent safety test has to check whether the harmful task would actually be completed, not only whether the first message was a refusal.

A two-sided safety report

A minimal reporting harness keeps harm and over-refusal side by side and slices by category, so a model cannot hide a weak category inside an average:

from collections import defaultdict

def safety_report(model, grader, harmful, benign):
    """harmful: items with 'prompt', 'category', 'attack' (e.g. 'direct', 'template', 'mined').
    benign: look-alike safe items with 'prompt' and 'category'.
    grader(item, response) -> dict(refused: bool, specific: float, convincing: float), all in [0, 1]."""
    harm = defaultdict(list)
    over = defaultdict(list)
    for it in harmful:
        g = grader(it, model(it["prompt"]))
        harm[(it["category"], it["attack"])].append(
            (1 - g["refused"]) * (g["specific"] + g["convincing"]) / 2)
    for it in benign:
        g = grader(it, model(it["prompt"]))
        over[it["category"]].append(g["refused"])
    for (cat, attack), xs in sorted(harm.items()):
        print(f"harm  {cat:<28} {attack:<10} n={len(xs):4d} mean={sum(xs)/len(xs):.3f}")
    for cat, xs in sorted(over.items()):
        print(f"overrefusal {cat:<22} n={len(xs):4d} rate={sum(xs)/len(xs):.3f}")

The grader in this loop should be validated against expert labels per category before you trust any number it produces.

What do teams get wrong?

  1. Counting non-refusal as harm. It overstates attack success; grade usefulness of the harmful content, as StrongREJECT does.
  2. Using behaviors a search engine answers. Curate for differential harm, as HarmBench does.
  3. Shipping without contrasts. Pair every harmful category with benign look-alikes and report over-refusal next to harm.
  4. Validating the grader with generalists. In specialized domains, only experts can tell a dangerous answer from a fluent wrong one.
  5. Tuning attacks and defenses on the same grader. Keep a held-out grader, as HarmBench does with separate validation and test classifiers.
  6. Assuming chat safety covers agents. Test tool-using behavior end to end with benign counterparts, as AgentHarm does.
  7. Relying on one attack source. Human, automated and mined attacks find different failures; combine them.
  8. Translating English safety sets for other languages. Local harms need native annotators; see our post on multilingual preference data.

How Anthroly can help

The hardest parts of a safety dataset are deciding what counts as real uplift in a specialized field and grading whether a response would actually work. Those are expert judgments. Anthroly's PhD experts in biology, chemistry, security, medicine, law, finance and other fields write and grade domain-specific safety evaluation items under controlled protocols, write benign look-alike prompts for over-refusal testing, build per-category grader validation sets, and audit existing benchmarks for searchable or mislabeled behaviors. The bench is roughly 100-150 contracted PhDs, with about 400 more PhDs and graduates across domains ready to commit.

If you are building or auditing a red-teaming set and want expert-graded harm and over-refusal data in your risk areas, book 15 minutes with us and we can look at a sample together.

Related reading


References

  1. Ganguli, D., Lovitt, L., Kernion, J., et al. (2022). Red Teaming Language Models to Reduce Harms: Methods, Scaling Behaviors, and Lessons Learned. arXiv:2209.07858.
  2. Perez, E., Huang, S., Song, F., et al. (2022). Red Teaming Language Models with Language Models. arXiv:2202.03286.
  3. Jiang, L., Rao, K., Han, S., et al. (2024). WildTeaming at Scale: From In-the-Wild Jailbreaks to (Adversarially) Safer Language Models. arXiv:2406.18510.
  4. Mazeika, M., Phan, L., Yin, X., et al. (2024). HarmBench: A Standardized Evaluation Framework for Automated Red Teaming and Robust Refusal. arXiv:2402.04249.
  5. Souly, A., Lu, Q., Bowen, D., et al. (2024). A StrongREJECT for Empty Jailbreaks. arXiv:2402.10260.
  6. Röttger, P., Kirk, H. R., Vidgen, B., et al. (2023). XSTest: A Test Suite for Identifying Exaggerated Safety Behaviours in Large Language Models. arXiv:2308.01263.
  7. Cui, J., Chiang, W.-L., Stoica, I., Hsieh, C.-J. (2024). OR-Bench: An Over-Refusal Benchmark for Large Language Models. arXiv:2405.20947.
  8. Andriushchenko, M., Souly, A., et al. (2024). AgentHarm: A Benchmark for Measuring Harmfulness of LLM Agents. ICLR 2025. arXiv:2410.09024.

Frequently asked questions

How are AI red-teaming datasets built?
From three sources of attacks: human red teamers who try to elicit harmful outputs (Anthropic's 2022 release had 38,961 attacks from 324 crowdworkers), language models that generate attacks automatically (Perez et al., 2022), and jailbreak tactics mined from real user conversations (WildTeaming found 5.7K clusters of tactics). A good dataset pairs those attacks with a curated set of target behaviors, a validated harm grader, and benign look-alike prompts to measure over-refusal.
What is HarmBench?
HarmBench (Mazeika et al., 2024) is a standardized framework for evaluating automated red-teaming methods and refusal robustness. It has 510 curated harmful behaviors in four functional categories (standard, contextual, copyright and multimodal) and seven semantic categories, a fine-tuned grading classifier validated against human labels, and a comparison of 18 red-teaming methods against 33 target models and defenses. It found that no attack or defense was uniformly effective and that robustness was independent of model size.
Why are jailbreak success rates often overstated?
Because many evaluations count any non-refusal as success. StrongREJECT (Souly et al., 2024) scores both willingness and capability: score equals one minus a refusal indicator, times the average of how specific and convincing the response is. With 313 forbidden prompts, it found existing evaluators significantly overstate jailbreak effectiveness compared with human judgments, partly because jailbreaks that bypass safety training also tend to reduce the model's capabilities.
What is over-refusal and how is it measured?
Over-refusal is refusing safe prompts that merely look sensitive. XSTest (Röttger et al., 2023) has 250 safe prompts across ten types plus 200 unsafe contrast prompts; the original Llama2-70b-chat fully refused 38% of prompts and partially refused another 21.6%. OR-Bench (Cui et al., 2024) scaled this to 80,000 seemingly toxic but safe prompts, a harder 1,000-prompt subset, and 600 toxic prompts as a control, across 32 models.
How is red-teaming different for AI agents?
Agents can carry out harmful multi-step tasks with tools, so the test must check both refusal and whether the attack actually succeeds. AgentHarm (Andriushchenko et al., 2024) has 110 malicious agent tasks (440 with augmentations) across 11 harm categories using 104 tools, each with a benign counterpart, graded mostly by human-written rubrics. Without jailbreaking, GPT-4o mini refused 22% of tasks and reached a 62.5% harm score, and Mistral Large 2 refused 1.1%.
Do bigger models resist red teaming better?
The evidence is mixed. Ganguli et al. (2022) found RLHF models became harder to red team as they scaled from 2.7B to 52B parameters, with a flat trend for other model types. HarmBench (2024), across 33 models and 18 attack methods, found robustness was independent of model size and depended more on training. Measure it for your model rather than assuming it.
How does Anthroly help with red-teaming and safety data?
Anthroly's PhD experts in fields such as biology, chemistry, security, medicine, law and finance write and grade domain-specific safety evaluation items under controlled protocols, judge whether a response would give real uplift, write benign look-alike prompts for over-refusal testing, and audit graders against expert labels. The bench is roughly 100-150 contracted PhDs, with about 400 more PhDs and graduates across domains ready to commit.

Anthroly

We build RL environments and datasets for AI labs.