How many generations a garak scan needs for a reliable result
garak makes 5 generations per prompt by default, and the recommended minimum is 2. The right setting sits between those points, and it depends on your inference budget and on how much a single lucky or unlucky sample could mislead your conclusion. garak is a free, Apache 2.0 licensed command-line tool installed from PyPI with pip, and the PyPI package requires Python 3.11 or newer. Because the model's output is stochastic, the same prompt can produce a safe answer on one attempt and an undesirable one on the next, so the generation count controls how many chances the model gets to misbehave before garak reports a result.
garak marks a probe as FAIL when any attempt produces undesirable output, and it reports a failure rate across the attempts. That rule matters for the setting you choose. A higher generation count gives a rare failure more opportunities to surface, which makes the result less likely to miss a transient weakness. It also means one bad sample can turn a probe into a FAIL, so a single unlucky generation can make a scan look worse than the model's typical behavior. Each attempt and its evaluation is written to the JSONL report, so you can check whether a FAIL rests on one sample or on many before you act on it. Confirm the current generation flag and its exact name in the garak user guide for your installed version.
Treat the setting as a budget decision. Every generation adds inference calls, so a hosted model or a rate-limited endpoint will cost more and take longer as the count rises. Start from the value your scan can afford, record it in your run configuration, and keep it fixed across runs so that a comparison after a model or prompt change reflects the change itself. The garak acceleration guide notes that reducing generations lowers inference demand, but dropping to 1 can miss transient behaviors, which is why 2 is the floor for a scan you intend to rely on. Ask your team or your partner to confirm the cost of the chosen count against your provider's pricing before a large scheduled scan.
Generation settings and when each fits
This table compares the generations setting, the recommended floor, and the soft probe prompt cap, along with where settings should live for repeatable runs. Read each row as a choice between cost and coverage: higher values catch more intermittent behavior, while lower values reduce inference demand. The main takeaway is that two generations is the lowest setting the garak guidance recommends for most scans.
| Setting | What it controls | When to choose it |
|---|---|---|
| Default generations (5) | garak makes 5 generations per prompt by default. A probe fails if any attempt produces undesirable output. | Use for high-risk probes or when a finding must be reproduced across many attempts, accepting higher inference cost. |
| Recommended minimum (2) | The garak acceleration guidance sets 2 as the recommended minimum generations per prompt. | Use as the floor when inference budget is tight, so stochastic outputs get a second attempt before a result is recorded. |
| Single generation (1) | The garak guidance warns that 1 generation can miss transient LLM behaviors. | Use only for quick smoke tests or pipeline checks, and do not treat a clean result as evidence of safety. |
| Soft probe prompt cap | Bounds the number of prompts a probe sends, not the number of attempts, so generations multiply against this limit. | Raise it for broader coverage of a probe family, or lower it to shorten runs and control inference spend. |
| Config file and site defaults | Generation and cap values can be set in a run config file and in organization-wide site defaults kept in version control. | Record the chosen values in version-controlled config so reruns use the same settings and comparisons stay valid. |
What generations do to inference cost
Generations sit at the center of a garak run's bill, but they are not the only multiplier. Each card below names one component that turns a generation setting into requests, tokens, time or spend, so you can estimate cost before committing to a full scan.
Generations multiply inference calls
Each prompt is sent once per generation, so the request count for a probe is roughly its prompt count multiplied by the generations setting. Reducing generations directly reduces inference demand, as the garak acceleration guide notes, but taking it down to 1 can miss transient model behaviour, which is why the recommended minimum is 2. Check the generations value first because every other cost driver multiplies from it.
- Default generations per prompt
- 5
Probe selection sets the prompt count
The number of prompts a scan sends depends on which probes and tags you select, not only on the generation count. A broad selection across many probe families can multiply requests well beyond a focused run against the risks your application actually carries. Use the probe list and tiers to scope the run, then confirm the resulting request count before launch.
Soft cap limits prompts per probe
The soft probe prompt cap limits how many prompts each probe sends, which bounds the cost of large prompt sets. Raising the cap increases coverage and spend together, so the cap and the generation count should be set as a pair. Ask your team which setting governs your run, and record both values with the report so a rerun uses the same budget.
Hosted API billing versus local GPU time
Hosted endpoints bill per request or per token, so every extra generation appears as a line item on the provider invoice. Local models consume GPU hours and power instead, and the cost shows up as queue time and hardware occupancy. Confirm which model is in use before estimating, because the same generation count costs very different amounts under each billing model.
Rate limits stretch run time
Provider rate limits cap how many requests reach the endpoint per minute, so a large generation count can extend a run from minutes into hours without adding any spend. Longer runs keep compute and staff time occupied, and they can collide with CI windows. Check the rate limits on your account and plan the scan schedule around them.
Detector and judge calls add cost
Detectors that call a judge model send extra requests on top of the generations, so the scored output costs more than the raw attempts. Keyword and classifier detectors add compute but usually little API spend, while judge-based scoring can double request volume. Confirm which detectors your scan enables, then measure their share of cost on a small probe set before a full run.
Setting generations and the prompt cap for a garak run
This sequence takes a garak install from a clean Python environment to a pilot run whose attempt counts match the generation and prompt cap settings you chose. The result is a reviewed baseline you can rerun and compare.
Install garak from PyPI
Create a dedicated virtual environment on Python 3.11 or newer, then install garak from PyPI with pip. Your platform team or the operator running scans does this on a host that can reach the target. Confirm the install by running garak's help command and recording the installed version, because the release you run determines which settings and report fields you can rely on. The step is done when the command runs without errors and the version is written down.
Confirm the target generator
Identify the generator that reaches the model or application under test, such as a hosted API, a Hugging Face model, or a REST endpoint described in a short YAML file. Send one manual request through the same path a scan will use, so you know authentication, rate limits and response format work. Done when a test call returns the expected plaintext or JSON content and you have noted any rate limit that will affect pilot timing.
Choose a probe set for the application
Select the probes that match the risks of the application rather than running everything by default. Use garak's probe listing to review families and tags, then write the chosen set into your run configuration. Done when the probe list is saved in version control with a short note on why each family was included, so a later reviewer can see the scope behind the generation counts.
Set generations per prompt
Set the number of generations per prompt in your run configuration. Use at least 2, which garak's acceleration guidance gives as the recommended minimum because a single generation can miss transient model behavior. Keep the default of 5 for high-stakes checks where you want more chances to surface an undesirable output. Done when the value is recorded in the config file and you can state the reason for the choice, including the inference cost you accepted.
Set the soft probe prompt cap
Set the soft probe prompt cap so each probe sends a bounded number of prompts, which controls total inference calls alongside generations. Ask the operator or vendor which cap behavior applies to the garak version you installed, because the setting interacts with generations and probe size. Calculate the expected attempt count per probe from the cap and generations, and write that number next to the config. Done when the expected totals are documented before the pilot starts.
Run a small pilot scan
Run a pilot with a narrow probe set and the chosen generations and cap, using a rate-limited or low-cost target if one exists. Keep the run identifier and the config file together so the output is traceable. Done when the pilot finishes and produces a JSONL report and a garak.log file without configuration errors that stop the scan early.
Check attempt counts in the report
Open the JSONL report and count attempts per probe, then compare them with the expected totals from the cap and generations. Read garak.log for warnings about skipped prompts, retries or generator errors that would change those counts. If the numbers differ, correct the config and rerun the pilot before a full scan. Done when counts match expectations, and the verified settings are committed to version control so future reruns use the same values.
How generations and the prompt cap shape a run
The diagram starts with the configured probes, where the soft prompt cap limits how many prompts each probe sends. Each prompt is then multiplied by the generations setting, so every prompt produces several attempts against the target through the generator. Each attempt passes to the recommended detectors, and the probe is marked FAIL if any single attempt is undesirable. Check that the generation count matches the cost you can accept, and that the report and log paths are where you expect them.
Generations multiply attempts per prompt before detectors decide the probe result.
Questions teams ask before setting generations
Is two generations enough for production checks?
Two is the recommended minimum, and it is a sensible floor for a regular check, but it is not a guarantee. garak's acceleration guidance says that reducing generations cuts inference demand, while dropping to 1 can miss transient model behaviours. A single attempt that looks safe may hide an unsafe output that appears only some of the time. Teams often run two generations for scheduled or CI scans to control spend, then raise the count for a release gate or a formal assessment where a missed failure carries more weight. Confirm the count against the risk your application carries before you standardize it.
Why does garak default to 5 generations per prompt?
garak makes 5 generations per prompt by default, and a probe is marked FAIL with a failure rate when any attempt produces undesirable output. The higher default gives a more thorough view of stochastic behaviour, because a model can answer the same prompt safely several times and unsafely once. The trade-off is inference cost. Every extra generation multiplies the calls to your model, so the default suits exploratory work and thorough reviews more than frequent, low-cost reruns. Treat 5 as a coverage setting and choose a lower value deliberately, documenting it so later runs are comparable.
How do generations interact with buffs and harnesses?
At a high level, generations multiply the work that buffs and harnesses create. A buff that paraphrases or encodes prompts produces more prompt variants, and each variant receives its own generations, so the total number of model calls grows with both settings. The harness decides which detectors run on each attempt. The default probewise harness runs each probe's recommended detectors, while the pxd harness runs every detector on every probe, which adds evaluation work on top of generation work. When you tune generations, check the buff and harness choices at the same time, because a small change in one can shift run time and cost more than the generation count does.
How does cost scale with generations, and what should I ask a partner for in a quote?
Cost scales roughly with the number of prompts, multiplied by generations, multiplied by any buff variants, on the model or endpoint you test. The main cost components are the target's inference charges or hardware time, the engineering effort to configure and run scans, and the review of results. Scope, probe set, target access and repeat runs are the factors to pin down. Ask a partner to state the probe set, the generation count and any buffs, whether the target is a hosted API or a local model, how many repeat runs are included, and what happens when a model or prompt changes. DeployOpen does not publish prices, and quotes follow from a written scope agreed before work starts.
Can our team tune the generation count alone?
Yes, many teams can set and adjust the generations value themselves, because it is a single run setting in garak. The harder part is deciding what the number should be for your application, which depends on the probes you run, the risk of a missed failure and the budget for inference. Your team will need access to the target model or endpoint, a stable configuration recorded in version control, and a way to review the JSONL report and garak.log after each run. If you lack time or experience with LLM security testing, a partner can set the baseline, document the reasoning and hand over a repeatable configuration. Confirm internal capacity before deciding.
Does the soft probe prompt cap change how many generations I need?
The soft probe prompt cap limits how many prompts a probe sends, and it works alongside the generation count rather than replacing it. Fewer prompts with more generations can produce a different picture from many prompts with fewer generations, so changing one without the other can make scans look better or worse for reasons unrelated to model behaviour. When you change the cap, record it with the generation count in your configuration so later reports can be compared. Check the cap and generation settings in your garak version's documentation, since behaviour can change between releases.
Security and operational considerations for repeated attempts
Each generation is another request to the target, another stored output and another line in a log. The cards below cover the traffic, storage, credential and retention decisions that follow from choosing a generation count, so the scan stays safe to run against a live system.
Confirm rate limits and abuse monitoring
Every additional generation per prompt multiplies the number of requests sent to the target. Across a full probe set, a count of 5 generations by default produces far more traffic than a count of 2. Before raising the count, confirm the endpoint's rate limits, quotas and whether the provider's abuse monitoring may flag or suspend the key for bursts of adversarial prompts. Ask the team that owns the endpoint whether scan traffic should be allowlisted or routed through a separate key.
Acceleration guideRestrict access to harmful outputs
Scan outputs contain the harmful text the model produced under attack, including toxic content, jailbreak responses and any leaked data. Store the JSONL report and HTML digest in a location with named access, encryption at rest and an owner who approves who may read them. Treat the directory as sensitive data rather than as a build artifact, and do not copy reports into general-purpose chat or ticketing tools.
Keep API keys out of generator config
Generator configs for hosted models and REST endpoints often carry API keys or bearer tokens. Do not commit a config file with literal credentials to version control, and do not paste keys into command lines where they appear in shell history. Load secrets from environment variables or your secrets manager, use a scan-specific key with the smallest quota the run needs, and rotate it after the scan schedule changes hands.
Review reports for sensitive prompts
Reports record the prompts sent and the responses received, so they can reproduce your system prompt, internal instructions, retrieved documents or personal data if the target echoes them. Data leakage findings are a direct example. Before sharing a report with a wider audience, review it for production secrets and customer records, and decide whether it should be redacted, shortened or kept inside the security team.
Plan retention for garak.log
garak.log is continued across runs rather than started fresh, so it grows with every scan and may hold request details, configuration values and errors. Set a retention period that matches your policy, rotate the file on a schedule and confirm that log shipping to a central system does not copy sensitive prompts into a store with wider access. Check the file after each run for credentials that a misconfigured tool may have written.
How DeployOpen scopes and runs garak scans
DeployOpen treats the generations setting as one part of a scan plan tied to your target model, your application and your inference budget. We scope the number of generations per prompt against the probes you run, then build, document and hand over a configuration your team can rerun.
How we scope
- Confirm which probes and attack families the scan must cover for your application
- Agree the generations per prompt and the probe prompt cap in the written scope
- Record the inference cost assumptions your team expects to pay for each run
How we build
- Create a version-controlled run configuration that sets generations explicitly for each scan
- Run a baseline at the agreed generation count and review how often outputs vary
- Check the JSONL report and garak.log to confirm each attempt was counted as expected
How we hand over
- Deliver the configuration files, the scan procedure and a short note explaining the generation choice
- Document the trade-off between extra generations and inference cost for your environment
- Walk your engineers through rerunning the scan and comparing results across model changes
How we support
- Available as a retainer for rescans after model, prompt or garak version changes
- Review generation settings when the target model, provider or budget changes
- Ongoing support and continuous testing are scoped in writing, with quotes following that scope

