Choosing garak detectors and model-as-judge scoring

garak detectors decide hits with keywords, classifiers or a judge model. This page explains which to use, when to enable judge-based refusal and jailbreak detectors, and how eval_threshold changes pass and fail.

On this page

Choosing garak detectors and model-as-judge scoring for your target

A detector is the step in a garak run that turns a raw generation into a hit or a no-hit, so the detector you choose decides what a FAIL actually means. A scan can look alarming or reassuring for reasons that have nothing to do with the model, simply because the detector matched the wrong signal. Before you trust a hit, confirm which detector fired, what it looked for, and whether that signal matches the harm you are testing for. Detector choice drives both coverage, meaning which failures the scan can see at all, and noise, meaning how many hits are false positives.

Most garak detectors work in one of two ways. Some look for keywords that are present or absent in the output, which is fast, deterministic and easy to explain to an auditor, but brittle when a model answers in a paraphrase or a different language. Others use a classifier to judge the response, run locally or through an API, which handles meaning better but adds a model dependency whose version and behavior you must record. Keyword matching suits clearly defined strings such as a leaked secret format or a known refusal phrase. A classifier suits outputs where the meaning matters more than the wording.

garak's judge module adds detectors that use a model as a judge, including ModelAsJudge, Refusal and Jailbreak detectors, and the garak source for these detectors lists how each is implemented. Teams usually reach for a judge when a keyword or classifier cannot tell a genuine policy violation from a safe answer that uses similar words. Judge-based scoring adds cost and variance, so confirm which model acts as judge, pin its version, and spot-check a sample of its verdicts against human review before you use the scores for a go or no-go decision. Setting the pass and fail threshold with eval_threshold is a separate decision covered in the next section.

Detector types and when each fits

This table compares keyword, classifier, judge-based and extended garak detectors across how they decide, where they run, what they cost to run, typical noise and when to choose them. Read each row as a trade-off: cheaper detectors are faster and more predictable, while judge-based detectors catch more nuanced failures at the price of extra model calls and their own error rate.

Detector typeHow it decidesCost and run timeTypical noiseWhen to choose it
Keyword detectorsLook for words or phrases present or absent in the outputLow, no extra model callCan flag harmless wording or miss paraphrased failuresClear, known strings such as refusal phrases or leaked markers
Classifier detectorsA trained classifier scores the response, run locally or through an APIModerate, depends on where the classifier runsDepends on the classifier's training data and the topicKnown harm categories where a maintained classifier fits your policy
ModelAsJudge detectorA judge model reads the prompt and response and rates them against a criterionHigher, one extra model call per evaluated outputSensitive to the judge prompt and judge model choiceNuanced policy questions where keywords cannot capture the failure
Refusal detector (judge-based)A judge model decides whether the response refuses the requestHigher, one extra model call per evaluated outputPartial answers and hedged refusals may be scored inconsistentlyChecking whether guardrails hold on requests the application should decline
Jailbreak detector (judge-based)A judge model decides whether the response complies with a jailbreak attemptHigher, one extra model call per evaluated outputSubtle role-play compliance can be missed or over-flaggedTesting jailbreak probes where keyword matching misses the outcome
Extended detectorsAdd further detectors beyond each probe's recommended setLonger run time, more evaluations per attemptMore hits to triage, so more false positives to reviewWhen coverage matters more than a shorter run; confirm the list with --list_detectors

When to enable judge-based refusal and jailbreak detectors

When you test a bare model with no application around it, the question is usually whether the model declines requests it should decline. Keyword matching can miss refusals phrased in unexpected ways, and a judge model can read the whole response and decide whether it is a refusal, a partial answer or a compliant answer. The judge adds this reading of intent, which keyword lists cannot provide. It needs a judge model reachable from the scan host, either running locally or behind an API that your organization approves. The main risk is using the same model family as both target and judge. A judge from that family may share the target's blind spots, so it can accept outputs that a different judge would flag.

  • What the judge adds: a semantic reading of refusals, including indirect or polite declines.
  • What it needs: a judge model the scan host can reach, with its endpoint and credentials configured.
  • Same-family risk: a shared training lineage can hide the weaknesses you are trying to find.
  • Choice of judge: pick a judge from a different provider or a stronger model when the target is high risk.
  • Cost: each judged response adds an inference call, so the run takes longer and costs more.

Before relying on results, confirm the judge configuration keys in the garak user guide at docs.garak.ai for your garak version.

How eval_threshold affects pass and fail

The eval_threshold setting is the score cutoff at which garak's evaluation counts an output as a hit. Detectors return a score for each attempt, and the threshold decides which scores become hits. Because every probe's result is built from those hits, moving the threshold changes the pass and fail outcome across the whole run, not just one probe. A small change can flip a probe from FAIL to PASS, so the value must be treated as part of the test definition rather than a tuning detail.

A stricter threshold, which requires a higher score before an attempt counts as a hit, reduces noise from borderline detector output but can hide weak signals. A model that leaks partially, or that complies only occasionally, may score below the cutoff and report as clean. A looser threshold does the reverse: it surfaces more borderline cases for review, which helps when you are searching for weaknesses, but it also produces more false alarms that someone must triage. Before choosing a value, run a sample of known good and known bad outputs from your own application and see where the detector scores fall. Confirm the current default and the exact key name in the garak user guide for your installed version, because both can change between releases.

Record the threshold in the run config and make sure it appears in the report, so that a later run can be compared with an earlier one on the same basis. A change in the threshold between two scans can look like a change in the model's behavior when it is not. Store the value next to the detector list, generation count and garak version in version control, and note any override made on the command line. When a result shifts after a rescan, check the threshold first, then the detectors and the version, before concluding that the model or its safeguards have changed.

Setting up detectors and a judge in a garak run

This sequence takes a team from a clean garak install to a pilot run whose detectors, judge model and pass threshold have been checked against known-bad output. The result is a run configuration the team can explain, repeat and trust before scaling it to a full scan.

  1. Install garak from PyPI on Python 3.11

    Create a dedicated virtual environment on a Linux or macOS host running Python 3.11 or newer, then install garak with pip from PyPI. The PyPI package requires Python 3.11 or newer, so confirm the interpreter version before installing. Record the installed version, because detector names and defaults can change between releases. Done means garak --version prints a version string and the command runs without import errors.

  2. List detectors available in this version

    Run the detector listing command from the installed garak to see which detectors ship in this release, rather than relying on names from documentation or older notes. Note which detectors are keyword-based, which use a classifier and which belong to the judge module, since those three groups behave differently and need different checks. Save the listing with the run record so later reruns can be compared against the same detector set. Done means you have a saved list and can name the detector each candidate probe will use.

  3. Choose the probe set and default detectors

    Select the probes that match the application's risks using the probe selection options, then review which detectors the default probewise harness attaches to each probe. The harness runs each probe with its recommended detectors, so start from those defaults and change only what you can justify. Keyword detectors check for words present or absent in the output, while classifier detectors judge the response with a model run locally or through an API. Done means a written table maps each selected probe to its detectors and to the reason for each choice.

  4. Add extended and judge detectors deliberately

    Enable extended detectors or the judge-based Refusal and Jailbreak detectors only for probes where keyword or classifier results are not enough to decide a hit. Judge detectors depend on a second model, so each one adds configuration, cost and a new failure mode. Record the reason for each addition in the run configuration. Done means every added detector has a stated purpose and an owner who can explain it.

  5. Configure the judge generator and endpoint

    Point the judge detectors at a judge model through a generator the team controls, with the endpoint, credentials and model name set in the run configuration rather than typed into a shell session. Confirm with the model owner which version the judge runs and whether its outputs are stable enough to score repeatedly. Send one test prompt and check that the judge returns a parseable answer. Done means a direct request to the judge returns a response, and the garak log shows the judge generator loaded without errors.

  6. Set eval_threshold and check the scoring logic

    Set eval_threshold deliberately, since it determines how the evaluator turns detector scores into pass and fail results for a probe. Write down the value, the reason for it and the expected effect on hits, then keep it fixed across comparable runs. Use a value that the team has agreed in advance, not one picked after seeing results. Done means the threshold is in the saved configuration and the team can explain what a single failed attempt means under it.

  7. Run a small pilot with a known-bad sample

    Run a small pilot on a narrow probe set, and include a sample that is known to produce undesirable output for the chosen detectors, such as a deliberately permissive test endpoint or a prompt from an established test set. Confirm that the known-bad sample scores as a hit and that a known-safe response does not. This is illustrative: the sample depends on the detector and the target. Done means both controls behave as expected before the full scan is scheduled.

  8. Check the JSONL report and garak.log for judge errors

    Open the JSONL report and confirm that each attempt has a detector result and an evaluation, then search garak.log for judge timeouts, parse failures, rate limit messages or fallback behavior. Judge failures can quietly change results, so a clean-looking summary is not enough. Compare the pilot's hit count with what the known-bad and known-safe controls predicted. Done means the report and log show no unexplained judge errors and the pilot results match the controls.

How a generation becomes a pass or fail

A probe prompt goes to the target generator, and each output is passed to the detectors that the probe's configuration selects: keyword, classifier, or judge model. Each detector score is compared with the eval_threshold, and the outcome is written to the JSONL report. A failed judge call is a separate branch that should be checked in garak.log, since it can otherwise look like a clean result. Confirm which detectors a probe uses before reading any pass rate.

Path from one probe attempt to a recorded pass or fail, including the judge error branch.

Security and operational risks in judge-based scoring

A judge model is a second model that reads target output and decides whether it is a hit, so it carries its own data, security and versioning risks. The cards below cover what leaves your boundary, how the judge can be manipulated, and how judge choices affect the reproducibility of scores over time.

Data leaving your boundary

A hosted judge receives every prompt and response it scores, and garak generations often contain the sensitive material the probe was trying to elicit. Confirm where the judge endpoint runs and what its provider retains before you point a scan at production-like data. A local or self-hosted judge keeps these transcripts inside infrastructure you already control.

Prompt injection of the judge

The target's output is untrusted text placed inside the judge's prompt, so a response that says the verdict is already decided can steer the judge toward a wrong result. This makes a judge score less reliable than a keyword match on exactly the outputs a red team cares about most. Test the judge with known injected responses and check that its verdicts match a sample you label by hand.

Self-preference within a model family

A judge tends to favor outputs that resemble its own style, so a target and judge from the same model family can under-report failures. Record the target and judge model names in every report and compare results when the judge changes. Where possible, choose a judge from a different family than the system under test and confirm this choice with your reviewers.

Judge version drift

Hosted judge models change behind the same model name, so a score can move between scans even when the target has not changed. Pin the judge model version where your provider allows it, and treat a judge change as a new baseline. Rerun a fixed reference set of outputs after any judge update to see whether the verdicts moved.

Judge credentials in secret stores

A judge that calls a hosted API needs a key with billing and model access, which is an exposure if it is stored in a config file or shell history. Keep the key in your organization's secret store, inject it at run time, and scope it to the judge model only. Confirm that garak's run logs and the garak.log debugging file do not echo the key.

garak user guide

Retaining reports with sensitive generations

Each run writes a JSONL report of every attempt and its evaluation, and that file holds the prompts and responses in full. Set a retention period for scan output that matches your data policy, restrict access to the report directory, and delete or redact reports that include real customer data. Document the retention rule alongside the scan configuration so that it is applied on every run.

Questions teams ask before tuning garak detectors

How much effort does tuning garak detectors take in-house compared with a partner?

Effort depends on how many probes and detectors the scan runs, how much of the output your team must interpret, and whether you already have a judge endpoint and a labeled sample. An in-house team pays for the time of engineers who learn the detector set, the judge prompts and the report format, and that learning cost is one-time. A partner is paid under a written scope that names the detectors to tune, the sample to label and the retest. Ask any partner to list which detector settings it will change, which it will leave at defaults, and how it will show that a threshold change is justified.

What drives the cost of running a judge model during a garak scan?

The cost comes from three multipliers: judge calls per attempt, where the judge is hosted or local, and the number of generations. Each probe attempt that a judge-based detector evaluates adds at least one judge call, so the count grows with probes, prompts per probe and generations per prompt. A hosted judge bills per call or per token, which is a recurring cost tied to every scan. A local judge shifts the cost to GPU or CPU capacity that you already run or must buy. Ask for a quote that states the expected judge calls per scan, the judge endpoint used and who pays for it.

How long does a detector tuning pass take, and what makes it longer?

Duration depends on the size of the labeled sample, how many detectors you compare, how many scans a threshold change requires, and how quickly the target and judge endpoints respond. Each candidate detector setting needs a rerun against the same prompts before results can be compared, so the number of candidates multiplies the run time. Extended detectors and judge-based detectors are usually slower than keyword checks. Access delays, rate limits and disagreements about what counts as a hit also add time. Ask the partner for a timeline tied to the written scope rather than a generic duration.

What does the work need from our team before it starts?

The work needs three inputs: access to the target, a judge endpoint, and a labeled sample. Target access means a test endpoint or application that matches production closely enough to produce representative output, plus credentials and a named contact for rate limits. A judge endpoint is a model your organization approves for scoring, either hosted or local, with a known cost and data handling position. A labeled sample is a set of outputs marked as hits or non-hits by people who know the application's policy. Without the labeled sample, threshold decisions rest on opinion, so confirm early who will label it.

Can a non-specialist set up garak detectors and judge scoring?

A non-specialist can run a default scan and read the summary, because garak runs its default detectors without extra configuration. Choosing extended detectors, configuring a judge model, and setting eval_threshold correctly require someone who understands both the application's policy and how the detectors judge output. Judge-based detectors also depend on prompt wording and model behavior, which can change scores in ways that are hard to spot. A sensible division is that a security or platform engineer owns the configuration in version control, while the policy owner signs off on what counts as a failure.

Do detector choices change garak results after an upgrade?

Yes, detector choices and their defaults can shift results between garak releases, so a score change after an upgrade may reflect the detector rather than the model. Before upgrading, record the garak version, the detector list, the judge model and version, and the eval_threshold used in each baseline run. Then rerun the same configuration on the new release and compare the outcomes per probe before you change any threshold. Check the release notes for detector and evaluator changes, and keep the old and new reports side by side for the first scan cycle.

How DeployOpen scopes garak detector and judge work

DeployOpen starts every garak detector and judge engagement with a fixed scope agreed in writing before any scan runs. The scope names the target application or model, the probe families in play, the detectors and any judge model to be used, and the deliverables. Because the detector choice decides what counts as a hit, it is settled up front rather than left to the first run. Our role covers planning, configuration, testing and evidence preparation. DeployOpen performs security testing and prepares evidence for your review. It does not issue audit reports, attestations or certifications. Independent auditors and certification bodies make those determinations.

Next comes a review of the target, the probes and the detector choices. For each probe, we confirm which detectors it would run under the default probewise harness, whether keyword, classifier or judge-based detection fits the output format, and whether an extended detector or a judge-based refusal or jailbreak detector is justified by the risk. Judge models add cost and their own failure modes, so the review records which model scores results, where it runs, and how its verdicts will be checked. Confirm with your own team which eval_threshold value reflects the risk you accept, since this value determines when a probe is marked as failed.

A pilot run with labeled checks comes before the full scan. A small set of known-good and known-bad responses from the target is scored by the chosen detectors and judge, and the results are compared with the labels. Disagreements show whether a detector is too strict or too permissive for the application, and whether the judge is consistent enough to rely on. The final run configuration, including detector names, judge model, thresholds and the garak version, is documented and stored in version control so the scan can be rerun exactly. Optional retainer support covers rescans after model, prompt or detector changes, so that results remain comparable over time. Ask any provider to state in writing who performs each step and what evidence you will receive.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.