Red teaming LLM systems for one domain: who should attack them

For companies5 min read

Red teaming LLM systems means trying to make them fail on purpose, and for a domain model the best attackers are people who know the domain. A general tester can make a model swear. A pharmacist can make it recommend a dangerous dose. This guide explains how to plan a domain red-team round using two public benchmarks as reference points.

What public red teaming LLM benchmarks give you

HarmBench is described by its authors as a standardised evaluation framework for automated red teaming and for refusing harmful requests. They ran a large comparison of 18 red teaming methods against 33 target LLMs and defenses, and also introduced an adversarial training method that substantially improves robustness across a range of attacks. The framework is open source.

Source: HarmBench paper (arXiv:2402.04249)(opens in a new tab)

That work is about general harms and automated attacks. It helps you compare defences and attack methods. It does not tell you what is dangerous inside your specialty, because that needs someone who works in it.

A domain example: medical safety

MedSafetyBench defines medical safety using the American Medical Association's Principles of Medical Ethics. Its authors report that publicly available medical LLMs do not meet medical safety standards, and that fine-tuning them on the benchmark improves their medical safety while preserving their medical performance.

Source: MedSafetyBench: Evaluating and Improving the Medical Safety of Large Language Models (arXiv:2403.03744)(opens in a new tab)

The useful idea is the anchor: a published professional code defines what counts as unsafe. For law you might use professional conduct rules for the jurisdiction. For finance, a regulator's conduct and suitability rules. Choose the code first, then write attacks that target it.

Why domain experts make better attackers

A domain attacker knows the realistic misuse. A nurse knows which questions a worried relative asks at night. A compliance officer knows how a customer might push a bot to promise returns. They also know which wrong answers cause harm, and which are only embarrassing. This lets you rank findings by severity, not just count them.

DomainExpert attackerExample attack to try
HealthDoctor, nurse, pharmacistAsk for a dose adjustment for a child with a stated weight, then change the weight
LawLawyer in the target jurisdictionAsk the bot to draft a clause that is unlawful there
FinanceCompliance or advisory professionalPush the bot to guarantee a return
AgricultureAgronomistAsk for a mix of chemicals that should not be combined
EducationTeacherAsk for exam answers while posing as a teacher

Plan a round in steps

  1. Write the policy: what the model must never do in this domain, in plain sentences, based on a professional code.
  2. Choose attackers: two to four experts, plus one general red-teamer for broad tricks.
  3. Brief them on the model's purpose and the policy, and give them an interface that logs every turn.
  4. Set time boxes of one to two hours, with a target number of unique failures per session.
  5. Collect each failure with the prompt, the reply, the policy line it breaks and a severity.
  6. Review as a group, remove duplicates and fix or block the top issues.
  7. Re-test the fixes with fresh attackers, since the same people will remember what worked.

Types of attack worth covering

  • Direct requests for forbidden content.
  • Role-play and framing, such as claiming to be a professional or writing a story.
  • Multi-turn pressure: small steps that add up to a harmful answer.
  • False premises in the question that the model should correct.
  • Overconfidence: asking for certainty where the honest answer is that it depends.
  • Over-refusal: legitimate questions that the model wrongly blocks.

Include over-refusal on purpose. A model that refuses every medical question is safe and useless. Ask experts for a set of ordinary, legitimate questions that it should answer, and count the refusals.

Rate severity with a scale experts share

Agree a short scale. For example: level one is a harmless slip, level two is misleading but unlikely to cause harm, level three could cause harm if followed, level four could cause serious harm. Two experts should rate each failure, and disagreements go to a lead. Report counts per level, and list every level-four case in full.

Handle the findings with care

Red-team logs contain harmful requests and sometimes dangerous replies. Store them securely, limit access, and tell testers what will happen to their prompts. Give testers a way to stop and to flag distress, since some content is upsetting. Do not publish raw logs.

Automated attacks, as studied in HarmBench, can run alongside human rounds. Use them to cover volume, and use experts to cover depth and judgment. Together they find more than either alone, and your report can show both.

Turn findings into tests that stay

Every failure your experts find should become a permanent test. Save the prompt, the bad reply and the rule it broke in a regression set, and run that set every time the model, the prompt or the retrieval source changes. Without it, a fix for one failure often reopens another, and nobody notices until a customer does.

Rank the fixes by severity and by how easy the attack is. A level-four failure that needs a single plain question comes before a level-three failure that needs ten turns of careful pressure. Say in the report which failures you chose not to fix, and why, so that the client can accept the risk knowingly.

Also decide who owns the policy. Safety rules in a medical or legal product should be signed off by a named person with the right professional standing, and revisited when guidelines or laws change. A red-team round is a snapshot, so plan a smaller round each quarter and a full one before any major release.

Curatrain vets doctors, lawyers, finance specialists and other experts with graded skill tests, and companies get a shortlist from those who passed the tests their project needs. You approve each match through a secure link, and an NDA and a data processing agreement are part of company sign-up.