Where the model under test should run during a garak scan
Run the model where your team can control its load, its failures and its data, and point garak at it through a generator that matches that setup. garak, the Generative AI Red-teaming and Assessment Kit, is a free command-line tool licensed under Apache 2.0 and developed in NVIDIA's GitHub organization. It probes LLMs and the applications built on them for weaknesses such as prompt injection, data leakage and jailbreaks. Each run sends prompts through a generator, and the generator decides how those requests reach the model. Your choice is therefore less about garak itself and more about whether the model is loaded inside the scan process, served by a separate process, or reached over the network through a hosted API or an internal REST endpoint.
Loading a Hugging Face model directly in garak suits a single engineer who wants a contained run on a dedicated GPU host and can afford to hold the model in memory for the length of the scan. It keeps the number of moving parts low, but the scan and the model compete for the same RAM and GPU memory, and garak's own dependencies must also fit on the disk. The garak FAQ notes that a local model needs disk space for the model plus about 9 GB of garak dependencies, and that a process killed while loading checkpoint shards usually points to RAM or GPU memory limits. Confirm those limits on the actual host before a long run. A self-served endpoint, such as one run by an inference engine on the same or a nearby host, suits teams that want the model to stay loaded across many runs, that share it with other users, or that need the scan to hit the same serving stack production uses. In that case the operations question shifts to the endpoint owner: request rates, timeouts and capacity must be agreed with them.
A hosted endpoint, whether a commercial API or an internal gateway reached through the REST generator, suits applications whose real attack surface is that endpoint, including guardrails, system prompts and tool layers sitting in front of the model. Testing the deployed path is often more informative than testing a bare model, but it also means that rate limits, billing and data-handling terms belong to a third party or another internal team. Before choosing, ask the endpoint owner for their request limits, retry behaviour and logging policy, and confirm which generator in the garak documentation at the garak user guide fits your target. Whichever path you choose, record it in the run configuration so a later rescan compares like with like.
Local Hugging Face loading versus hosted or self-served endpoints
This table compares the ways garak can reach the model under test, from loading weights in the scan process to calling a hosted API. Read each row for what the host must supply, who controls rate limits and failures, and which setup fits your constraints. The main takeaway is that local loading puts GPU, RAM and disk pressure on the scan host, while hosted and self-served endpoints move capacity and throttling to someone else.
| Option | What it needs from the host | Who owns rate limits and failures | When it fits |
|---|---|---|---|
| Local Hugging Face Hub loading | GPU or CPU with enough RAM and VRAM for the model, disk for the weights, plus about 9 GB for garak dependencies (garak FAQ) | The scan host. A process killed while loading checkpoint shards usually points to RAM or GPU memory limits | Open-weight models you control, with no external calls and enough dedicated scan hardware |
| gguf models through llama.cpp | Less memory than full-precision weights, disk for the quantized file, CPU or GPU support depending on the build | The scan host. Throughput depends on the quantization and hardware chosen | Quantized local models on modest hardware or workstations |
| LiteLLM as a model gateway | Network access to the gateway and a configured key, with little local compute | The gateway operator sets budgets and limits. Confirm how your gateway reports throttling to garak | Organizations already routing approved providers through a shared gateway |
| REST generator against a self-served endpoint | Network path and TLS trust to the endpoint, a YAML file describing the request and response shape | The endpoint owner sets capacity and rate limits. Agree request rates before the scan starts | Internal model services or applications where the scan must test the deployed system, not a bare model |
| Hosted APIs such as OpenAI, Replicate or AWS Bedrock | Outbound network access, API credentials held in a secrets store, and budget for per-request charges | The provider sets quotas and throttling. Scan-side retries add load and cost | Fast starts on commercial models when data-handling terms and vendor review allow external calls |
| Air-gapped or restricted hosts | Pre-staged packages, model artefacts and dependencies, with no live download at scan time | The local operator. Confirm which probes or detectors fetch data at run time | Regulated environments where traffic must stay inside a defined boundary |
| Parallel attempts | More memory or GPU capacity for concurrent local inference, or a higher request budget for hosted calls | Local: the scan host. Hosted: the provider, which may reject bursts | Only after a single-worker baseline completes cleanly on the chosen target |
| Mid-run failure recovery | Enough free disk for logs and partial reports, and a way to resume or rerun failed probes | Shared: local failures sit with the host, hosted timeouts sit with the provider and network path | Long scans where a stopped run must be diagnosed before rerunning |
How much disk and memory a local garak run needs
A local garak run needs two separate pools of storage: disk space for the model weights and about 9 GB for garak's own dependencies, according to the garak FAQ. Size the disk for the model you plan to test, then add that overhead, and leave headroom for the Hugging Face cache, which keeps downloaded files in addition to the copy the process loads. The disk figure is a floor, not a budget, so confirm the actual footprint of each candidate model on the scan host before the first run.
Memory is driven mainly by the model's parameter count and the numeric precision it is loaded at. Full precision weights take far more GPU or system RAM than half precision, and quantized formats such as those used through llama.cpp reduce the footprint further, at the cost of possibly changing model behavior under test. Loading also needs temporary headroom beyond the steady-state size, which is why a process is often killed while loading checkpoint shards. The FAQ attributes those kills usually to RAM or GPU memory limits, so the first load is the moment to watch.
Measure on your own hardware rather than relying on generic sizing tables. Load the exact model, precision and quantization you intend to scan, run a short probe set, and record peak RAM, peak GPU memory and disk use with your system monitor. Ask whoever owns the host for the total RAM and VRAM available to the scan user, and confirm that no other workload shares the GPU during the run. Repeat the measurement after any model or dependency upgrade, because either can change the numbers.
Setting up a local or endpoint-backed scan step by step
This sequence takes a team from a bare host to a verified garak run against either a local model or a hosted endpoint. Each step ends with a check, so problems surface on a small probe set rather than in a long scan. The output is a working configuration and a JSONL report you can trust as a baseline.
Confirm Python 3.11 or newer
The engineer responsible for the scan host checks the interpreter version before anything else, because the PyPI package requires Python 3.11 or newer. Run
python3 --versionon the host that will run garak, and confirm the version reported is 3.11 or higher. If the host only has an older interpreter, install a supported one first, since a failed install on the wrong version wastes time later. The step is done when the version check passes on the scan host itself, not on a developer laptop.Install garak into a dedicated environment
Create a separate virtual environment for garak so its dependencies do not collide with other Python tools on the host. Activate it and install the tool from PyPI with
pip install garak. Then runpython -m garak --helpto confirm the command loads. Expect a local model setup to need disk space for the model plus several gigabytes of garak dependencies, which the garak FAQ notes, so confirm the host has that capacity before you install. The step is done when the help output prints without import errors.Choose the generator for your target
Decide where the model under test runs. A local Hugging Face model loads into the scan host's own memory and GPU, which keeps data on the host but ties the scan to that hardware. A hosted or self-served endpoint, such as an OpenAI API model, an OpenAI-compatible server or a REST endpoint described in YAML, moves the compute elsewhere and makes rate limits and network reliability the main risks. Confirm with the endpoint owner which option they expect, and record the generator name you will use. The step is done when the choice and its reason are written in the scan runbook.
Configure the local model or endpoint
For a local model, confirm the model files are on disk and that the host has enough free RAM or GPU memory for the checkpoint. For an endpoint, create the configuration for the generator, including the endpoint address, the authentication source and the request format, and keep credentials in environment variables rather than in files that get committed. Ask the endpoint owner for their request rate limit and any allowed concurrency before you set parallelism. The step is done when a single manual test prompt returns a sensible response from the model or endpoint.
Confirm the model loads fully before scanning
For a local model, load it on its own first and watch memory during loading. The garak FAQ notes that a process killed while loading checkpoint shards usually hit RAM or GPU memory limits, so a kill at this stage is a sizing problem, not a garak bug. Lower the memory footprint, use a smaller model or move the run to a larger host before continuing. The step is done when the model loads to completion and generates a reply without the process being killed.
Run a small probe set first
Start with a deliberately narrow probe selection and a low generation count so the run finishes quickly and shows whether the whole pipeline works. Run the command with the chosen generator and the probes you selected, and keep the default of five generations per prompt in mind when you read the results, since any single undesirable attempt marks a probe as FAIL. Watch the console for generator errors, timeouts or rate-limit responses, which point to configuration or endpoint problems. The step is done when the small run completes end to end without a crash.
Check the JSONL report and garak.log
Open the JSONL report written by the run and confirm it contains one record per attempt with an evaluation attached, which shows the detectors ran. Then read garak.log, the debugging file that continues across runs, and search it for errors or repeated retries. If the report is empty, or every attempt shows the same generator error, fix the configuration before scaling up. The step is done when the report has the expected attempts and the log shows no unexplained failures, and you can name the report path to use in later runs.
Why local scans die while loading checkpoint shards
The garak FAQ notes that a process killed while loading checkpoint shards usually hit a RAM or GPU memory limit, so memory exhaustion during model load is the first explanation to test. A local Hugging Face model is read shard by shard into memory, and a large model can exceed available host RAM or GPU memory before the first prompt is ever sent. Before starting a scan, confirm the free RAM and free GPU memory on the scan host, compare them with the size of the model's weights in the precision you plan to load, and leave headroom for the garak process itself. The FAQ also says the model needs disk space on top of the roughly 9 GB of garak dependencies, so check free disk on the volume where the Hugging Face cache lives.
To diagnose the failure, read garak.log first, since it is continued across runs and records where loading stopped. A run that ends with no error from garak and a log that stops during shard loading points to a process kill by the operating system, which is typical of an out-of-memory condition. Check the kernel log on Linux or the system log on macOS for out-of-memory killer entries at the same timestamp, and watch GPU memory with the vendor's monitoring tool while the model loads. Confirm the exact message and timing in your own environment, because the wording varies by platform and driver.
A crash mid-run leaves a partial JSONL report, because garak writes each attempt and its evaluation as it goes. Treat that partial file as incomplete evidence, not as a result, and do not compare its failure rates with a finished run. Restart from a clean state: keep the failed artifacts under a distinct report prefix, record the garak version, model revision, generator configuration and probe set used, and then rerun with the same configuration on a host that has the memory to load the model. Only compare the new run with earlier runs when those recorded settings match, otherwise the change in results may come from the setup rather than the model.
How parallelism differs between local and hosted targets
The same garak settings behave very differently depending on where the model runs. A local GPU, a self-served endpoint and a hosted API each set a different ceiling on how many attempts can run at once, and each ceiling has a different owner.
A single local GPU serializes work
When garak loads a Hugging Face model onto one GPU, generation requests queue behind each other on that device. Raising parallel attempts does not add throughput once the card is saturated, and it can add memory pressure. Check GPU utilization and memory during a short pilot before raising concurrency, and see the sibling page on running garak with parallel attempts for the settings involved.
Self-served endpoints cap at serving capacity
A model served through an inference server has its own batching, queue depth and worker count. garak can send more requests than the server will process at once, which shows up as slow responses, timeouts or dropped requests. Ask the endpoint owner for the concurrency the server is sized for, and test with a small worker count first.
Hosted APIs impose rate limits
Hosted providers enforce request and token limits per key or account, and those limits are shared with the organization's production traffic. A scan that exceeds them receives throttling responses that garak must handle. Confirm the limits for your key with the provider, and plan the scan around them rather than the other way round. The sibling page on handling rate limits and timeouts covers the retry behavior.
system.parallel_attempts and max_workers set concurrency
In garak, system.parallel_attempts controls how many prompt attempts run concurrently, and max_workers controls the worker threads used by a generator. Setting them together determines the request rate a target sees. Record both values in the scan configuration so that a repeat run uses the same concurrency and results stay comparable.
File descriptor limits cap parallel connections
Each parallel request holds open sockets and file handles, and the operating system limits how many a process can hold. High concurrency on a scan host can fail with connection errors that look like endpoint faults. Check the open file limit on the scan host before a large run, and raise it deliberately if needed. Treat errors from this limit as a host problem, not a target problem.
Request rates must be agreed with the owner
The owner of the target endpoint, whether an internal platform team or a model provider, should know the expected request rate, duration and source address of the scan before it starts. Agree a maximum rate and a contact for stopping the run. A scan that the owner did not expect can look like an attack and trigger blocking or incident response.
How a garak request reaches the model under test
A scan starts in the garak harness, which runs each probe with its detectors and sends prompts through a generator. The generator is the hand-off point: it loads a local model on the scan host, calls a LiteLLM or REST endpoint, or calls a hosted API across a trust boundary. Responses return to the detectors, and results land in the JSONL report and garak.log on the scan host. Check which side of the boundary each model runs on and who owns the endpoint.
Generator choice decides which trust boundaries a garak prompt crosses.
Security and operational risks of where the model runs
Each place a garak scan can point carries its own exposure, from the credentials that reach the endpoint to the reports that store harmful output. The cards below cover the decisions that connect those exposures, so the team can settle them before the first scan rather than after a finding is filed.
Keep API keys out of configs and logs
Hosted generators and REST targets need credentials, and the easiest mistake is pasting a key into a YAML config or a shell history line that then lands in version control or CI logs. Pass secrets through environment variables or your secrets manager, and check that garak.log and the JSONL report do not echo request headers. Rotate any key that appears in a shared log, and confirm the scan account has only the permissions the probes need.
Treat reports as harmful content
A garak report records the prompts sent and the outputs returned, and for jailbreak and toxicity probes those outputs can be unsafe in their own right. Decide who may read the report directory, how long it is kept, and where it is stored before the first run. Set the storage location deliberately with report_dir and restrict access to it, so a shared drive does not become a repository of attack transcripts.
Limit network exposure of self-served endpoints
A model served on a host you run for testing is reachable by everything on that network, and a scan can flood it with requests. Bind the server to the scan network only, place it behind authentication, and avoid exposing the port to the internet or to general corporate VLANs. Confirm who else can reach the endpoint and whether its logs record the scan traffic, since the endpoint owner will see every probe request.
Confirm data residency for hosted APIs
When garak sends prompts to a hosted model API, the prompts and any system prompt or application data in them leave your environment and fall under the provider's terms. Read the vendor's data handling, retention, training use and region commitments before scanning a production configuration, and confirm them in writing with your procurement or legal team. Use synthetic prompts and test accounts where the terms do not match your data classification.
Isolate the GPU host
A host that loads model weights and runs inference shares its GPU, memory and disk with anything else scheduled on it, and a scan can exhaust those resources. Run scanning workloads on a dedicated host or a separate node pool, keep the model cache and report directories on storage with access controls, and separate the scan network from production segments. Record which account runs the scan so audit logs can attribute activity to it.
Questions teams ask before running garak against their own models
Does running garak against a local model cost more than calling a hosted endpoint?
It depends on where the cost lands. A local Hugging Face model costs you hardware, power, and staff time, and the spend is mostly one-time for the machine and recurring for its operation. A hosted or self-served endpoint costs you per-request or per-token fees, plus the capacity of whatever serves it. The main cost driver in both cases is request volume, which comes from the probes you select and the number of generations per prompt. By default garak makes 5 generations per prompt, so narrowing probes or reducing generations lowers spend in either model. Ask your team to estimate request counts before choosing an option, and ask any hosted provider for its current per-request pricing in writing.
How much disk space and memory does a local garak scan need?
A local model needs disk space for the model files plus about 9 GB for garak's own dependencies, according to the garak FAQ. Memory needs depend on the model size, precision, and whether it runs on a GPU or CPU. The FAQ notes that a process killed while loading checkpoint shards usually hit RAM or GPU memory limits, so that message is your first clue about sizing. Check the model card for the memory it requires, then test loading it on the scan host before a full run. Confirm the exact figures for your model with its publisher rather than relying on general estimates.
Why does my garak run get killed while loading the model?
The most common cause is running out of memory while loading checkpoint shards. The garak FAQ says processes killed at this stage usually hit RAM or GPU memory limits. Start by checking free system RAM and GPU memory during the load, then try a smaller model, a lower-precision variant, or a host with more memory. Also confirm that the model files finished downloading and are not truncated. If the process is killed later, during generation, look at garak.log, which is continued across runs, and at the JSONL report to see how far the scan got before it stopped.
Should I use a local Hugging Face model or a self-served endpoint for garak?
Choose local loading when you want the scan to control the model directly and you have the hardware to hold it. Choose a self-served endpoint when the model is already running behind a service that your application uses, because the scan then tests the same path your users reach. The garak REST generator can connect to any REST endpoint that returns plaintext or JSON, configured with a short YAML file. Local loading also avoids network variables, but it ties the scan to the scan host's resources. Document which option you chose, since changing it can change results.
How much parallelism can a local GPU model handle during a garak scan?
Parallelism on a local GPU is limited by memory, not by garak. Each concurrent generation uses model memory and compute, so running more parallel attempts than the hardware can hold typically causes slowdowns or memory failures. Hosted endpoints have their own concurrency limits and rate limits, which you should agree with the endpoint owner before raising parallel attempts. Start with low concurrency, watch GPU memory and latency during a short probe set, and increase only while the host stays stable. Record the setting in your scan configuration so later runs are comparable.
What does a garak scan on a hosted endpoint need from my team?
Your team needs the endpoint details, a valid credential stored outside the config file, and agreement from the owner of the endpoint on request volume and timing. You also need a scan host with Python 3.11 or newer, since the PyPI package requires it, and a plan for where the JSONL report and garak.log will be stored. Expect the endpoint owner to ask how many requests the scan will send. Keep a short probe set for first runs, so you can confirm the connection works before committing to a full scan. Most of this work can be done in-house by a team comfortable with Python and command-line tools.
Can our own team run garak against local or hosted models without outside help?
Yes, garak is free to use under Apache 2.0 and installs from PyPI with pip. A team with Python skills and access to the model can handle installation, configuration, and first scans. Outside help is most useful when the target sits behind enterprise controls such as client certificates or private CAs, when hardware sizing is unclear, or when the scan must run on a restricted network. DeployOpen can plan and run these scans in your infrastructure if you want that support. Scope, deliverables, and timelines are agreed in writing before any work starts, and a quote follows from that scope.
How DeployOpen scopes garak scans on your infrastructure
DeployOpen plans, installs and runs garak inside your own environment, whether the model under test is loaded locally on a GPU host or reached through a hosted or self-served endpoint. The scope is agreed in writing before work starts, and that document fixes which probes run, which target and generator configuration is used, where the JSONL reports and garak.log file are stored, who may access the output, and how the scan host is prepared. Because the tool runs against your model, the scope also has to state the request volume the endpoint owner has approved and the window in which scans may run, so that load on a shared service is agreed rather than discovered in its logs.
The written scope separates the work into decisions the client makes and tasks DeployOpen carries out. Typical client decisions include whether the target is a bare model or a full application with a system prompt, guardrails and tools, which team owns the endpoint and its rate limits, and whether scan output containing harmful prompts may be stored on the host. DeployOpen's part covers the scan host sizing check for disk and memory, the garak installation in a pinned Python environment, a test run that confirms the generator loads and the endpoint responds, and a documented procedure for resuming or rerunning after a failure. Ask for each of these items to be listed with an owner and a completion condition, and ask for any cost component that depends on request counts or GPU hours to be stated as an assumption tied to the agreed probe list.
Scoping can also connect scanning to wider security work. DeployOpen can pair garak runs with application and API security testing, testing of AI systems and agents, and red teaming, and can prepare the scan results as part of the evidence a compliance assessment may request. DeployOpen prepares systems, controls and evidence for those assessments, but independent auditors and certification bodies issue any audit report, attestation or certification, so the written scope should name which outputs are for internal review and which, if any, a third party will examine. Confirm with the client's compliance team which evidence format they accept before the first scan, since that choice changes how reports are retained and labeled.

