Skip to main content
Dataset-based attacks allow you to load prompt injection test cases from curated or custom datasets, enabling reproducible and consistent security testing.

Overview

When to Use

  • Reproducible testing: Exact same attacks across runs
  • Compliance audits: Documented, traceable test cases
  • Custom attack libraries: Your organization’s specific attacks
  • Regression testing: Consistent baseline for comparisons

StaticDatasetProbe

StaticDatasetProbe is the shared engine behind catalog *DatasetProbe classes (hate, leaks, off-topic, agentic limits, and more). It loads bundled YAML from trusttest/datasets/static_objectives/ — not your own files. For user YAML/JSON/Parquet, use DatasetProbe below.
ModelFocusCompany values: alibaba, amazon, anthropic, apple, chatgpt, cohere, deepseek, google, meta, mistral, nous, nvidia, openai, perplexity, reflection, xai, zyphra. Category-specific wrappers (HateDatasetProbe, DirectRequestDatasetProbe, …) pass a fixed category and expose the same jailbreak / translation knobs.

Using Built-in Catalog Scenarios

The catalog builders wrap *DatasetProbe (or generated single-turn probes) for you:

Creating Custom Datasets

YAML Format

Create a YAML file with your attack prompts:

JSON Format

Parquet Format

For large datasets, use Parquet for efficient storage:

Loading Custom Datasets


Combining Datasets

Merge multiple datasets for comprehensive testing:

Dataset Best Practices

Structure

  • One attack per test case: Each list item is one attack
  • Clear descriptions: Make true/false descriptions unambiguous
  • Diverse attacks: Cover multiple attack patterns

Maintenance

  • Version control: Track dataset changes
  • Regular updates: Add new attack patterns as they emerge
  • Document sources: Note where attacks came from

Quality

  • Test manually first: Verify attacks work as expected
  • Balance difficulty: Include easy and hard attacks
  • Cover edge cases: Include variations and edge cases

Saving Test Results

Save test sets for future reference: