Skip to main content
HarmBench is a behavioral safety benchmark Promptbeat can use as a seed source. It gives you a known harmful-content seed pool, a clear local CSV layout, and — once you’ve run the smoke slice — a saved Codex validation result. This page shows exactly how to load HarmBench data, map it to Promptbeat risk types, and run an evaluation. Use HarmBench for direct harmful-content refusal checks first. It is not a replacement for coding-agent boundary tests such as secret handling, sandbox boundary, terminal injection, or network egress.
HarmBench raw data is not bundled with Promptbeat. You must download the dataset separately from HarmBench on GitHub and place the files in your local datasets directory before running any HarmBench-backed evaluation.

Local file layout

Place the HarmBench CSV under your PROMPTBEAT_DATASETS_DIR directory using this exact path:
The CSV must contain these columns in order:
An example source row looks like this:
Promptbeat reads Behavior as the prompt, BehaviorID as the record identifier, and SemanticCategory as the category label for risk mapping. The remaining columns — FunctionalCategory, Tags, and ContextString — are preserved under metadata.raw_metadata in every seed so reports can point back to the original record.

DatasetSpec YAML

Define the following DatasetSpec to tell Promptbeat how to parse the HarmBench CSV:
The category_map provides a shorthand pre-mapping from SemanticCategory values to Promptbeat risk type IDs. Use a full DatasetRiskMapping (shown in the Risk mapping section) to route records to specific scenarios.

Python DatasetSeedLoader

Use DatasetSeedLoader to load HarmBench records into typed Seed objects inside your Python evaluation scripts:
core/datasets.py
Pass limit to cap the number of records loaded from the CSV. Omit it to load all records that pass the category filter.

Seed shape

Each loaded HarmBench record becomes a Seed with this shape:
The id field combines the dataset name and the original BehaviorID with a colon separator. The raw_metadata block preserves the original CSV columns verbatim so you can reconstruct the exact source record from any report row.

Risk mapping

Define a DatasetRiskMapping to route HarmBench seeds to the correct scenario and judge. For direct harmful-content refusal, map the primary harmful categories to harmful_content:
Set unmappedPolicy: skip to silently drop records whose SemanticCategory has no rule. For coding-agent scenarios, treat HarmBench as one seed source among several — combine it with repo, terminal, filesystem, or network fixtures when testing agent behavior rather than relying on it as the only risk surface.

Generated test shape

When Promptbeat converts a HarmBench seed into a Promptfoo test case, the generated entry records full dataset provenance:
Every generated case carries dataset, recordId, category, and source fields so reports can group results by dataset family and category without losing the link to the original raw record.

Run commands

Run validation and evaluation using either the uv form or the installed binary. Generate a 5-case HarmBench slice:
Evaluate the generated slice:
The evaluation writes results to --output-dir. Saved artifact paths from the current validation run follow this layout:

Observed results

The current Codex HarmBench smoke slice passed 5 of 5 cases. This confirms the dataset pipeline is working end-to-end and that the target refuses direct harmful-content requests in the tested categories.
Passing 5/5 on the HarmBench slice does not mean the agent is safe. It does not cover:
  • Secret environment variable reads
  • Protected file reads
  • Terminal output injection
  • Repository prompt injection
  • Sandbox boundary probes
  • Network egress attempts
  • Verifier or report tampering
Use the HarmBench slice as a dataset plumbing smoke test, then move to agent-specific scenarios for real agent safety coverage.