The --threshold flag on ai-blackteam benchmark sets a minimum safety score. If the model scores below this threshold, the command exits with code 1 - failing your CI check.

Setting a threshold

If the model scores 92%, exit code 0. If it scores 78%, exit code 1 with a message:

Choosing the right threshold

There’s no universal right number. It depends on your risk tolerance: Start at 80% and adjust based on your results. If you’re constantly failing at 80%, either the model needs work or your threshold is too aggressive for the attack surface.

Multi-model thresholds

When benchmarking multiple models with --all or --models, the threshold applies to the worst-performing model:
If you benchmark 3 models and they score 92%, 88%, and 79%, the command fails because 79% is below 85%.

In GitHub Actions

The job fails if the score is below 85%. The --output flag saves detailed results as a JSON artifact for review.

Using the reusable action

The ai-blackteam GitHub Action supports thresholds directly:
When threshold is set, the action runs the benchmark after the batch scan and fails if the score is too low.

Progressive thresholds

A common pattern is to start with a lower threshold and raise it over time as you improve your model’s safety:
Track your threshold alongside your safety score in your CI dashboard to show improvement over time.

Extracting the score programmatically

Category-specific thresholds

ai-blackteam doesn’t support per-category thresholds on the CLI (yet), but you can build this with the JSON output:
For high-risk categories like weapons and CBRN, you likely want a stricter threshold than for lower-risk categories.