When TAP and PAIR in garak are worth running
Run garak's TAP and PAIR probes when you need to know whether a guarded model or application holds up against adaptive jailbreaks, not just the fixed prompt lists that static probe families send. Both use an attacker LLM to write candidate jailbreak prompts, send them to the target, read the response, and refine the next attempt based on what happened. garak's tap module provides three entry points: TAPCached, which replays stored attack prompts, and TAP and PAIR, which generate new attacks live. TAP follows the Tree of Attacks with Pruning method, a community implementation of which garak wraps, while PAIR is the simpler iterative refinement approach. Both are reactive: each attack depends on the target's previous reply.
That reactivity is what single-turn probe families cannot provide. A static family such as DAN or encoding sends a fixed set of prompts, so its results show how the model handles known attacks but say little about a determined attacker who adapts. Iterative probes add value when the application has a meaningful refusal layer, such as a guardrail or moderation step, that a fixed prompt could pass by chance, or when the question for the risk owner is whether a motivated attacker can eventually get past it. They are less useful as a routine check on a model with no refusal behavior to test, or when the goal is a fast regression signal after each model change. The garak FAQ lists tap and suffix among its compute-intensive reactive probes, so plan them as a periodic deeper test rather than part of every scan.
Before scheduling them, confirm with your security and platform teams which attacker model you will use, who pays for its inference, and whether the target's data may be sent to that attacker model's provider. The attacker and target together determine both the compute bill and the evidence quality, so ask whether the cached variant can replay a prior run for comparison. Write down the question the result must answer, such as whether a system prompt or guardrail resists iterative refinement, so the scan scope and the success criteria are agreed before the first live run.
How TAP and PAIR generate jailbreaks
Both probes use an attacker model to write jailbreak prompts, send them to the target, and score the replies. The cards below cover the loop, how TAP and PAIR differ in search strategy, and what garak's source does and does not show about the implementation it wraps.
The attacker, target and judge loop
An attacker model proposes a candidate jailbreak prompt for a harmful goal. The target model responds, a judge scores how close that response came to the goal, and the loop repeats with the attacker revising its prompt based on the score. Each round produces new prompts, so the cost grows with the number of rounds and candidates, not just with the number of prompts in the probe. Check which model plays each role before reading any result.
garak tap sourceTAP branches and prunes candidates
Tree of Attacks with Pruning keeps several candidate prompts at once and arranges them as a tree. Each branch is expanded into new variants, and weak branches are pruned before they consume more target queries. The tree structure is what separates TAP from a single chain of revisions, so a TAP run explores more paths for the same goal. Ask how many branches and pruning steps the configured implementation uses before comparing run times.
PAIR refines one prompt at a time
PAIR, short for Prompt Automatic Iterative Refinement, follows a single line of attempts. The attacker revises the most recent prompt using the target's reply and the judge's score, then tries again. Fewer candidates are kept at each step, so PAIR is simpler to reason about than TAP and usually needs fewer parallel target calls. Its narrower search can miss jailbreaks that a branching search would find.
What garak wraps
garak's tap module provides TAPCached, TAP and PAIR probes that wrap a community implementation of Tree of Attacks with Pruning. The module is the authoritative description of the attack logic, so read it before assuming a behavior such as stopping criteria or judge prompts. Do not treat the probe names as a guarantee of a particular search algorithm beyond what that file shows.
Judge quality limits findings
Every loop depends on a judge deciding whether the target's reply is harmful. A judge that is too strict will report misses that are really successes, and a lenient judge will flag refusals as jailbreaks. Confirm which judge model and scoring rule the run uses, and spot-check a sample of flagged and unflagged transcripts from the JSONL report before treating counts as evidence.
Attacker model and cost
The attacker is usually a separate LLM with its own hosting cost, rate limits and terms of use. Each round adds attacker calls and target calls, so compute and API spend scale with depth and breadth. The compute-intensive status of TAP and suffix probes is noted in the garak FAQ, which is why cached versions exist. Ask your provider or platform team to confirm the cost of both models before scheduling a run.
garak FAQChoosing the attacker and target models
The attacker model writes the jailbreak candidates that TAP and PAIR send to the target, so it sets the quality of the search. Its job is to produce varied, on-topic adversarial prompts and to refine them from feedback, which is a different skill from answering questions safely. Confirm how the attacker is served in your environment, because a hosted attacker sends generated attack text to a third-party provider, while a local attacker keeps that text inside your network.
- Capability: Test whether the candidate produces usable attack variants for your target category, not just whether it runs.
- Refusal behavior: Many aligned models refuse to write attack prompts, which stalls the search. Check refusal rates on a small sample before a long run.
- Licensing: Confirm the model license permits this use, including red-team and security testing, and check any usage policy terms.
- Hosting: Decide between a hosted API and a model you serve locally, and record which one each scan used.
- Cost driver: Each iteration calls the attacker, so a larger or hosted attacker raises per-run cost in proportion to iterations.
Before a scan, confirm the attacker's license, hosting location and refusal rate with your own sample, and record the exact model version in the run configuration.
The target is the model or application that TAP or PAIR attacks. Testing a bare model and testing the full application, with its system prompt, retrieval, tools and guardrails, produce different findings. An iterative attack against an application tests the behavior your users actually reach, so the endpoint definition matters as much as the model name.
- Endpoint shape: Decide whether you test a raw model, a REST endpoint wrapping your application, or a guarded endpoint. Each answers a different question.
- System prompt and tools: Confirm which instructions, retrieval sources and tool permissions are active during the scan.
- Rate limits and cost: Confirm the target's request limits and whether it bills per call, since iterative search sends many requests.
- Data handling: Confirm whether the target logs prompts and whether attack traffic is allowed on that environment.
- Staging parity: Test against an environment that matches production in model version and configuration, or record the gap.
Before a scan, confirm with the application owner that attack traffic is permitted and that the endpoint definition matches the deployed configuration.
The judge decides whether a target response counts as a successful jailbreak. A weak judge produces false passes and false failures, and the attack search then optimizes toward the judge's mistakes. Treat the judge as a component you validate, not a fixed setting in the tool.
- Agreement check: Label a sample of target responses yourself and measure how often the judge agrees before trusting its scores.
- Judge independence: Avoid letting the attacker judge its own outputs when possible, since shared behavior can hide failures.
- Hosting and data: Confirm where judge calls go, because the judge reads full target responses, which may contain sensitive content.
- Version pinning: Record the judge model and prompt version so later runs stay comparable.
- Scope of verdict: Judge outputs are indicators for review, so keep a human review step for findings you report.
Before a scan, confirm the judge's hosting, pin its version and run a small labeled sample to set your trust level.
TAP, PAIR and cached probe options compared
This table compares garak's TAPCached, TAP and PAIR probes by what each runs, whether it calls an attacker LLM live, and how reproducible its output is. Read each row as a decision point: the cached variant replays stored prompts, while the live variants generate new ones against your target. The main takeaway is that live iterative runs cost more compute and vary between runs, so confirm the attacker and generation settings before comparing results over time.
| Option | What it runs | Attacker LLM and compute | When it fits a scan plan |
|---|---|---|---|
| TAPCached | Replays previously generated Tree of Attacks with Pruning prompts against the target | No live attacker call; lower compute because prompts are reused | Routine or scheduled scans where repeatable inputs matter more than fresh attacks |
| TAP | Generates new jailbreak prompts iteratively with an attacker model, pruning weak branches | Live attacker LLM calls; compute-intense, as listed in the garak FAQ | Periodic deep tests after a model or system prompt change, with budget set for the attacker |
| PAIR | Iteratively refines a jailbreak prompt using an attacker model and target feedback | Live attacker LLM calls; compute-intense, as listed in the garak FAQ for the reactive family | Focused tests of whether an iterative, single-thread attack can break a guardrail |
| Attacker model choice | The model that writes candidate prompts for the target | Confirm the default and supported options in the garak docs; a different attacker changes results | Record the attacker identity in every report so runs can be compared later |
| Generations per prompt | Attempts the target gets per prompt; garak defaults to 5 | More generations raise runtime and target calls, and the default of 5 applies unless changed | Keep the setting fixed across comparison runs, and confirm the exact flag in the garak docs |
| Reproducibility | Whether the same run gives the same prompts and outcomes | Live runs vary between executions; cached runs reproduce the stored prompts | Use cached runs for regression checks and live runs for exploratory discovery |
| Result reading | Each attempt and evaluation is written to the JSONL report | Failure is marked when any attempt produces undesirable output | Compare FAIL rates only between runs with the same probe, attacker and settings |
Setting up a TAP or PAIR run in garak
This sequence takes a team from a clean garak installation to a complete TAP or PAIR run with readable results. Each step ends with a check, so configuration errors in the target, attacker or judge surface before the iterative attacks start.
Install garak on Python 3.11 or newer
The engineer who runs the scans installs garak from PyPI with pip in a virtual environment on Linux or macOS, using Python 3.11 or newer, since the PyPI package requires that version. Pin the garak version you tested so later comparisons stay valid. The step is complete when the garak command starts and reports its version without errors. Record the version in the scan notes, because results from different releases are not always directly comparable.
Describe the target endpoint in YAML
The engineer who owns the application describes its endpoint in a short YAML file for garak's REST generator, which works with any REST endpoint that returns plaintext or JSON. Confirm the request body format, the authentication header and the path where the response text appears. Send one benign prompt through the generator and check that the reply is parsed into plain text. Do not run attacks until a benign prompt returns the expected answer, since a parsing error will otherwise look like a model weakness.
Choose the attacker and judge models
The security engineer selects the attacker model that writes candidate jailbreaks and the judge model that scores whether each response is undesirable. TAP and PAIR both depend on these two models, so their quality and cost shape the results. Confirm with the garak user guide which model and endpoint each probe calls by default, and whether you can point them at your own approved provider. Record both choices in the scan configuration. The check is a single test round where the attacker produces a candidate prompt and the judge returns a score you can read.
Decide between cached and live runs
The security lead decides whether to run the TAPCached variant, which replays prior attack results, or the live TAP and PAIR probes, which generate new prompts against the target. The garak FAQ lists the non-cached tap and suffix probes as compute-intense reactive probes, so live runs carry the largest model usage. Live runs are the right choice when the target, system prompt or guardrails have changed since the last scan. Write down which variant you chose and why, so the report can be read in context.
Run a small pilot first
The engineer runs one TAP or PAIR probe against the target with a deliberately narrow scope, such as a single probe and a small number of attempts, keeping garak's defaults for generations unless the plan says otherwise. The pilot shows how many model calls each attempt consumes and whether the attacker and judge behave as expected. Watch the token usage on the provider side during the pilot. The step is complete when the run finishes and the JSONL report contains attempts with both the attacker prompt and the target response.
Run the full TAP or PAIR probe
After the pilot passes, the engineer runs the full TAP or PAIR set against the agreed scope, with the same configuration used in the pilot so the results can be compared. Monitor the provider's usage and rate limits during the run, and stop it if the spend or error rate moves outside what the team approved. Keep the run identifier and configuration file together so the scan can be reproduced. The step is complete when every planned probe has finished or has a recorded reason for stopping.
Review the JSONL report and log
The security engineer reviews the JSONL report, which records every attempt and its evaluation, and the garak.log file, which continues across runs. Check for attempts marked as errors, responses that failed to parse, and judge scores that do not match the transcript. Confirm that any probe marked as FAIL shows a failure rate and the attempts behind it. The step is complete when the team can trace each reported failure back to a specific attacker prompt, target response and judge decision, and has noted any runs that need to be repeated.
What drives compute cost in live TAP and PAIR runs
The garak FAQ lists the tap and suffix probes as compute-intense reactive probes and excludes their cached versions from that label. The distinction matters for budgeting: a live TAP or PAIR run pays for every step of the attack search, while a cached run replays prompts that were generated earlier. Before you schedule live runs, ask your team which of the two you intend to use, because the cost profile of each is different.
A live run spends money on several components. The attacker model generates candidate jailbreaks for each branch and iteration. The target model receives each candidate and returns a response. A judge step scores those responses to decide which branches to keep and which to prune. Garak's default of 5 generations per prompt also multiplies the target calls for any candidate that is tested repeatedly. Each component has a different owner: if the attacker runs on a hosted API, you pay per token to that provider, while a local attacker on your own GPU costs hardware time and power. The target calls are usually charged to whoever operates the application under test, which may be a separate team or an external vendor.
Costs recur with every live run and rise with the search width. Branch count, search depth, generations per prompt, the size of the attacker model and hosted per-token pricing all push the total up, and the costs compound because each iteration depends on the previous one. Cached replay removes the attacker and judge calls from the loop, which changes the recurring spend to the target calls alone. Before you approve a quote or an internal budget, confirm the branch and depth settings, the attacker and judge models, the pricing terms of any hosted provider, and whether your rate limits will slow the run.
How the attacker, target and judge loop fits together
The loop starts in the garak harness, which sends a probe to the attacker model. The attacker LLM drafts candidate jailbreak prompts, and the target generator answers each one. A detector or judge then scores the responses, and the pruning or refinement step decides which branches continue. Check the trust boundary: the attacker and target may sit on different endpoints, and both write into the same JSONL report and garak.log.
Attacker, target and judge loop with the reporting files outside both trust zones.
Security and operational considerations
TAP and PAIR runs generate prompts with one model, send them to another, and write every attempt to disk. Each card below is a point where you decide what the run may touch, store, send out or repeat, and each one should be settled before the first scan.
Attacker-generated harmful content
The attacker model writes jailbreak prompts that often ask for harmful content, and those prompts and the target's replies sit in your report files. Decide who may open the output, where it lives and how long it stays. Confirm that the attacker model's own safety behaviour is acceptable for your team, since a refusal stops the iteration early and a compliant attacker produces material you must handle as sensitive.
JSONL reports and log storage
Each run writes a JSONL report of every attempt and its evaluation, and garak.log continues across runs. Both files record full prompts and responses, so treat them as security records with access control, encryption at rest and a defined retention period. Decide the output directory per project so one team's TAP results are not mixed into another's comparisons.
garak FAQAPI keys for attacker and target models
A TAP or PAIR run may call two hosted services at once: the attacker model that generates prompts and the target under test. Give each its own scoped key, load them from a secrets store rather than shell history, and rotate them after the engagement. Confirm which account the spend and usage log land in, because the attacker side can generate many more calls than a standard scan.
Rate limits and third-party data flow
Iterative attacks multiply requests, so a single run can hit provider rate limits or exhaust a quota mid-scan. Check the provider's data handling terms for both models, since the target's system prompt and the attacker's generated text may be processed outside your boundary. Ask whether the provider retains prompts for training or abuse monitoring, and whether a self-hosted attacker is an option for sensitive targets.
Scans in CI pipelines
Running TAP in CI is possible but rarely cheap or fast enough for every commit, so schedule it as a periodic job rather than a gate on merges. Store API keys as protected pipeline secrets, restrict the job to approved runners, and publish reports as restricted artifacts. Pin the garak version so that a release upgrade does not change scores between scheduled runs.
- Minimum Python version
- 3.11
Air-gapped and restricted hosts
TAP and PAIR need outbound reach to a model endpoint, so a fully air-gapped host works only if both the attacker and target run inside the enclave. Plan the install from a mirrored PyPI package, pin Python 3.11 or newer, and confirm that any locally served attacker model fits your hardware. Keep the iterative probes out of any environment where the attacker cannot be supervised.
Questions buyers ask about TAP and PAIR in garak
How much compute does a live TAP or PAIR run need?
A live run needs an attacker model, the target model and a judge, and each iteration sends prompts to all three. The compute bill depends on which of those models you host and which you call through a paid API. Compute rises with the number of branches and iterations you configure, because each candidate prompt costs at least one attacker call, one target call and one judge call. Ask your provider or your team to confirm the exact request count per probe from the garak configuration before you estimate spend. Local GPU time, hosted endpoint pricing and rate limits all change the total, so get those figures from your own environment and vendor pricing pages rather than from this page.
Should we use cached TAP runs instead of live runs?
Cached runs replay jailbreak prompts that were generated earlier, so they avoid most of the attacker-model compute. garak's FAQ lists tap and suffix as compute-intense reactive probes and excludes their cached versions from that category, which is a useful signal that the cached variants are the lighter option for routine scans. The trade-off is that cached prompts were built against a different target, so they test whether known iterative jailbreaks still work, not whether your model can be broken by a fresh attack. Many teams run cached probes on every scan and reserve live TAP or PAIR for release gates or for a model that has changed materially.
How long does a TAP or PAIR run take?
Duration is set mainly by the number of iterations, the branching in TAP, the response time of each model in the loop and how many parallel requests your endpoints allow. Because every iteration waits for the target and judge before the next candidate is built, a live run is slower than a static probe of similar size. Rate limits on hosted APIs can add long pauses, and a slow local GPU can dominate the schedule. Measure one short pilot run in your environment, then extrapolate using the configured limits. Cached runs finish much faster because they skip the attacker step.
Can our internal team run garak TAP and PAIR probes?
Yes, if the team can install garak from PyPI on Python 3.11 or newer, write a generator configuration for the target and set up an attacker and judge model. garak is free to use under Apache 2.0, so the software itself has no licence fee, but your staff time, model hosting and API charges are real costs. Internal teams often underestimate the work to tune the attacker prompt, validate that the judge scores are reliable, and read the JSONL report and garak.log output correctly. A partner can take that on under a written scope if your team lacks capacity.
What access and resources does the work need from our team?
Plan for four inputs: access to a test endpoint for the target model or application, credentials for the attacker and judge models, a place to run garak with enough compute and network reach to those endpoints, and a named owner who receives the report. The target should be a staging or test system that mirrors production settings, including system prompt and guardrails. Ask whether the attacker model may be a hosted service, since the prompts it generates are adversarial content. Also agree on who reviews findings, how retests are handled and where reports are stored. These items should appear in the written scope and the quote.
When are iterative attacks not worth the cost?
Iterative attacks are often not worth running when the model is only a narrow component behind strong input and output controls, when the application does not expose the output to users, or when a cheaper static or cached scan already covers the risk you need to measure. They are also poor value for early-stage model selection, where many models must be compared quickly. Live TAP or PAIR runs make the most sense before a high-risk release, after a model or system prompt change that could shift safety behaviour, or when a regulator or customer asks for evidence against adaptive attacks. Confirm your threat model first.
Do TAP and PAIR results prove that a model is safe?
No. A run that produces no successful jailbreak only shows that the attacker model, judge and iteration budget did not find one in that session. Results depend on the attacker prompt, the judge's accuracy and the configured limits, so a clean run is a bounded test result, not a guarantee. Record the configuration, model versions and garak release used, and treat the output as one input to a wider security assessment. Use the garak reports guidance and confirm judge accuracy on samples before you rely on the numbers in a compliance file.
When iterative attacks are worth the compute
Run garak's TAP or PAIR probes when single-turn probes come back clean but the application still has a reason to fear a determined attacker. The typical case is a model with refusal training or a guardrail layer, where static prompts pass because they are easy to recognize, while an attacker LLM that rewrites its prompt after each refusal may find a route through. TAP and PAIR are also the right tool before a release that changes the model, the system prompt, the guardrail configuration or the tools the model can call, because those changes can reopen paths that a previous scan closed. Treat iterative runs as a deliberate review step, not a default for every build.
The cost of a live run is the reason to limit them. Each iteration calls the target and the attacker model, so compute, API spend and wall-clock time grow with the search, and the garak FAQ lists tap and suffix among its compute-intense reactive probes. Ask your team to confirm the expected call volume for the probe settings you intend to use, and who pays for the attacker model, whether a hosted API or a local GPU. Cached TAP runs replay previously generated attack prompts against the target, which is the cheaper option for routine checks, though a cache built against an older model may miss attacks that the current model is now vulnerable to.
A practical scan plan uses both modes in sequence. Run fast static and dynamic probes on every build to catch regressions, run cached TAP on a schedule to replay known iterative attacks, and schedule live TAP or PAIR runs at pre-release gates and after any model, prompt or guardrail change. Record which mode produced each result so that a clean cached run is not later read as proof of resistance to fresh adaptive attacks. Where the findings matter for a decision, your security team should confirm the attacker model, probe settings and target configuration in the report before accepting the result.
How DeployOpen scopes and delivers garak TAP and PAIR testing
DeployOpen plans and runs garak TAP and PAIR testing as a fixed-scope engagement, with the attacker model, target endpoint, compute and cost limits agreed in writing before any run starts. The work is delivered in infrastructure you control, with the reports, configuration and run records handed over so your team can repeat the testing.
How we scope
- Confirm which target endpoints, models and application shapes TAP or PAIR runs will attack, and why iterative attacks fit them.
- Agree the attacker model, where it runs and whether runs are live or replayed from cached results.
- Set written limits on generations, iterations, compute and attack budget so the cost of each run is known in advance.
How we build
- Configure garak's TAP, TAPCached and PAIR probes against the agreed target using a REST or other generator set up for your endpoint.
- Run a small pilot first to check that the attacker and judge produce usable prompts and that detector results are readable.
- Document the configuration files, probe selection and detector settings so each run can be repeated with the same parameters.
How we hand over
- Deliver garak JSONL reports, the garak.log file and a written summary of which attack paths succeeded and which were blocked.
- Provide a runbook covering how to rerun cached and live TAP or PAIR scans and how to record the compute used.
- Walk your security and platform teams through the findings and the fixes recommended for each failed probe, with a retest plan.
How we support
- Ongoing support, upgrades and continuous testing are available as retainers, including rescans after model or prompt changes.
- Track garak version changes so report comparisons stay consistent across runs and upgrades.
- Confirm with your team any attacker model licensing, data handling and hosting limits before scheduling recurring iterative runs.

