Scanning Ollama models with garak: what the integration does
If your team serves models through Ollama on hardware you control, you need an independent view of how those models respond to adversarial input before users or auditors ask for one. garak connects to Ollama through its OllamaGenerator and OllamaGeneratorChat generators, which talk to Ollama's local REST API. This is a generator that ships with garak, so the integration is configuration and operations work on your side, not a custom build of the scanner.
garak is a command-line vulnerability scanner for LLMs. Its probes send prompts designed to elicit weaknesses such as prompt injection, jailbreaks, data leakage, toxicity and hallucination, and its detectors judge whether each response is undesirable. Each scan writes a JSONL report listing every attempt and its evaluation, plus a garak.log file that carries across runs, so the output can be kept as a record of what was tested against which model. By default garak makes 5 generations per prompt and marks a probe as FAIL when any attempt produces undesirable output, which is why the same model can show different failure rates between runs.
The Ollama generators are the entry point for a scan of a locally served model, and the questions that matter come next: which host and port Ollama listens on, whether the endpoint requires authentication, and which generation options should match production. Confirm those values in your own environment before the first run, because a scan against the wrong endpoint or default settings will produce a report that does not describe the model your users reach. The sections that follow cover each of these settings in turn.
What you need before the first Ollama scan
A garak scan against Ollama depends on four things lining up: the scan host, the Ollama runtime, the network path between them and the garak release. Confirm each one before you write a generator config, so a failed first run points to a single cause.
garak installed from PyPI
Install garak with pip on a host running Python 3.11 or newer. The tool is developed on Linux and macOS, so confirm the scan host's operating system and Python version in your environment before you install. Use a virtual environment so the pinned garak version stays isolated from other tools on the host. Keep the garak.log file and JSONL reports on storage you control, since each run appends to them.
Pin the garak release
Pin the version rather than installing whatever pip resolves on the day of the scan. The Ollama options passthrough and Ollama authentication arrived in v0.17.0, so any host on an earlier release will not honor those settings. The current release is v0.17.1, published on 16 October 2026. Record the pinned version in your scan configuration so reports can be compared later.
garak releasesOllama runtime and a pulled model
Install Ollama on the machine that will serve the model. Ollama is an MIT-licensed runtime with a llama.cpp backend and is available for macOS, Windows, Linux and Docker. Pull the exact model tag you plan to test, because garak sends requests by model name and a missing model fails the first attempt. Confirm the disk, memory and GPU needs for that model size in your own environment, since these depend on the model and quantization you choose.
Ollama repositoryNetwork path to port 11434
Ollama listens on 127.0.0.1 port 11434 by default, so a scan host on another machine cannot reach it until you change the bind address with the OLLAMA_HOST environment variable. Decide whether the scan runs on the same host as Ollama or across your network, and open only the path that the scan needs. The local API does not require authentication, so restrict who can reach that port and place a proxy with access controls in front of it if the scan crosses a network boundary.
Data handling and cloud settings
Ollama states that local runs do not expose your prompts or data to Ollama. Cloud features are separate, and you can turn them off with OLLAMA_NO_CLOUD=1 or in the server configuration file. Set these before the first scan in regulated environments, and record the setting in the scan evidence. Direct cloud inference uses a Bearer API key, which is a different credential from the local API and should be kept out of generator files you commit.
Hardware and model sizing
Scan speed on a local Ollama server depends on the model size, quantization, available GPU memory and how many requests the server runs in parallel. Ollama's default is one parallel request per model, so garak's five generations per prompt will queue unless you raise OLLAMA_NUM_PARALLEL. Benchmark a small probe set on your hardware before you schedule a full run, and ask your platform team to confirm capacity for the model you intend to test.
How to configure garak against an Ollama host
This sequence takes a team from a fresh garak install to a verified scan of an Ollama-served model inside its own network, with each step ending in a check that confirms the connection works before a full run starts.
Install garak in a Python 3.11 environment
Create a virtual environment on the host that will run the scans, then install garak from PyPI with pip. The PyPI package requires Python 3.11 or newer, so confirm the interpreter version first. The step is done when
garak --helpprints its command options without errors. Pin the version you install and record it, because the release you test against affects how results compare over time. The current release at the time of writing was v0.17.1, released on 16 October 2026.Confirm the Ollama API responds on port 11434
Before touching garak, check that the Ollama server answers on its REST port from the machine that will run the scan. By default Ollama binds to 127.0.0.1 on port 11434, so a scan host on another machine will not reach it unless the bind address has been changed with the OLLAMA_HOST environment variable. Confirm the model you plan to test is present with the Ollama model list command. The step is done when the API returns the list of installed models from the scan host. The local API does not require authentication, so no key is needed at this stage.
Choose OllamaGenerator or OllamaGeneratorChat
garak ships two Ollama generators. Use OllamaGenerator for a completion-style model, where the scan sends a raw prompt and reads back continued text. Use OllamaGeneratorChat when the model is driven through a chat template with system, user and assistant roles, which is the case for most instruction-tuned models. Choosing the wrong one does not always fail loudly, so confirm the model's intended interaction style from its documentation before you commit to a generator. The step is done when you have written down which generator name you will pass to the scan command.
Set the Ollama model name for the scan
Pass the exact model name and tag that Ollama lists, including any tag such as a size or quantization suffix, because a mismatched tag causes the request to fail or to hit a different model than intended. Record the name in your scan configuration so later runs test the same artifact. The step is done when a single test generation returns text from the named model and garak reports that the generator loaded without error.
Override the host in a generator config file
If Ollama is not on 127.0.0.1:11434, set the host in a generator configuration file rather than relying on the built-in default. The garak Ollama generator reads its host from configuration, so create a small YAML file with the host value for your Ollama server and pass it to the scan. Keep this file in version control next to your other scan settings. The step is done when a test generation against the remote host succeeds, which shows the request crossed your network path and reached the intended server.
Run a short probe and read the JSONL report
Start with a small probe set and the default probewise harness so the first run finishes quickly and shows whether the whole path works. Each run writes a JSONL report of every attempt and its evaluation, and appends to a garak.log file across runs. Open the report and confirm that attempts, outputs and evaluation fields are present for each probe you selected. The step is done when the report file exists in the run directory and contains entries for the model you named, which confirms the configuration before you schedule a full scan.
Host, binding and authentication settings for a shared Ollama server
Ollama binds to 127.0.0.1 on port 11434 by default, which means a scan host on another machine cannot reach it until you change the bind address. The OLLAMA_HOST environment variable sets that address on the server side, and the Ollama FAQ describes exposing the service through a reverse proxy such as Nginx. Choose that path deliberately. Binding Ollama to a network interface moves the access decision out of the default loopback boundary, so the scanning team needs an owner for whatever sits in front of the API. On the garak side, the OllamaGenerator and OllamaGeneratorChat generators default to 127.0.0.1:11434 and read a different host from a generator config file, so the host value in your scan configuration must match the address your proxy actually exposes.
The local Ollama API does not require authentication. Anyone who can reach the port can list models and send generation requests, so authentication has to come from your network or proxy layer. Ollama's API authentication documentation covers a different case: direct inference against Ollama's cloud endpoints, which requires an API key sent as a Bearer token. Keep those two cases separate in your design. A shared on-premises server that scan hosts reach over the network does not gain authentication just because cloud inference uses one. garak v0.17.0 added Ollama authentication support and custom client keyword arguments, which lets a generator send credentials and client options when it connects. Confirm in the garak releases notes and the generator source how those values are passed before you rely on them, and test with a request that should be rejected.
Before you open the server to scan hosts, confirm how your proxy handles access control. Ask the platform or network team which identities or source addresses may reach port 11434, whether the proxy terminates TLS, whether it logs requests, and whether it can require a header or token that the garak client can send. Then run two checks from a scan host: a request that must succeed and a request from an address that must fail. Record both results with the scan configuration so the evidence survives a later review. If the proxy cannot enforce the policy you need, keep the server on loopback and run garak on the same host instead.
Generator settings mapped to Ollama and garak
This table maps each garak generator setting to the Ollama component it controls, so you can see which side of the connection a value must match. Read each row as a question: where does this value take effect, and what must you confirm in your own Ollama version before a scan. The main takeaway is that garak settings only reach the model through Ollama's own host, authentication and request handling, so check those on the server first.
| Garak setting | Ollama side it controls | What to confirm |
|---|---|---|
| Generator name (OllamaGenerator or OllamaGeneratorChat) | Choice of Ollama endpoint: completion style or chat style request | Pick the chat generator for chat-tuned models and confirm the endpoint your model tag supports |
| Model name | Model tag pulled into local model storage | Run the tag on the Ollama host first so the scan does not fail on a missing model |
| Host (default 127.0.0.1:11434, set in a generator config file) | Bind address set by OLLAMA_HOST on the server | Confirm the server binds to the address garak connects to, and that a proxy in front of it is configured |
| Authentication and API key | Local API has no authentication by default; cloud endpoints require a Bearer token | Confirm whether your Ollama deployment sits behind a proxy that adds authentication, and where the key is stored |
| Options dict (generation parameters) | Request parameters forwarded to the model at inference time | Check each parameter name against your Ollama version's API documentation before relying on it |
| Client keyword arguments | Settings passed to the Ollama client library used for requests | Verify the keyword names against the client version installed with garak |
| Generations per prompt (default 5) | Number of requests sent per prompt, which share the server's parallel and queue limits | Set concurrency on the server with OLLAMA_NUM_PARALLEL and OLLAMA_MAX_QUEUE to match this count |
Passing generation options and keeping scans repeatable
Generation settings are the part of an Ollama scan most likely to drift without anyone noticing. Since garak v0.17.0, generation parameters are forwarded to Ollama through its options dict, so sampling and length settings can be fixed in the configuration rather than left to model defaults. Confirm the exact keys your Ollama version accepts against the generator source in garak's generators/ollama.py before you write them into a file, and set the same values for every run you intend to compare. Treat the options block as part of the test definition, in the same way you treat the probe list.
The reason this matters is that garak makes 5 generations per prompt by default and marks a probe as FAIL when any attempt produces undesirable output. Each extra sample is another chance to surface a failure, so a change in temperature, top-p or output length can move the failure rate without any change in the model or its guardrails. Record the options in the garak configuration file next to the run, and keep that file under version control with the JSONL report and garak.log it produced. When someone later asks why two scores differ, the answer should be visible in the files rather than reconstructed from memory.
Also agree on who may change these values. An options change is a change to what was tested, so route it through the same review as a probe change, and state it in the report summary when you compare runs. If you need to test a production-like configuration, run it as a separate, named configuration rather than editing the baseline. Ask your security team to confirm which settings they consider representative of how users reach the model, because that decision determines whether the scan result is evidence about your deployment or only about garak's defaults.
What local serving means for scan speed
A garak scan against Ollama is limited by how many requests the server will run at once, how many requests it will queue, and how fast the model runs on your hardware. These four drivers set the wall-clock time of a scan, so check each one before you schedule a run.
Parallel requests per model
Ollama runs one parallel request per model by default, controlled by OLLAMA_NUM_PARALLEL. garak sends attempts through its generator, so a scan with a high concurrency setting will still wait in line on the Ollama side if this value stays at 1. Before you raise garak's parallelism, confirm the server value with the team that operates the host. Raising the server value also increases memory use, because each parallel slot holds its own context. Test the change on a short probe run first and watch memory on the host during the run.
Models loaded at the same time
OLLAMA_MAX_LOADED_MODELS sets how many models stay in memory at once. The default is 3 times the number of GPUs, or 3 on CPU. If your scan rotates between several models, or a second team uses the same server, a model may be unloaded and reloaded between runs. Reloading adds load time to the first attempts of each probe batch, which slows the scan without changing its results. Record model load time separately from generation time so you can see which one dominates.
Queue depth for scan bursts
OLLAMA_MAX_QUEUE holds requests that wait for a free parallel slot, with a default of 512 queued requests. garak multiplies attempt volume by probe count and by generations per prompt, which defaults to 5, so a broad probe selection can approach or exceed the queue during a burst. Requests that exceed the queue are rejected, and garak will log errors rather than produce a complete report. Estimate the attempt count from the probe list before the run, compare it with the queue limit, and check the garak.log file afterward for rejected or timed-out requests.
Hardware under the model
Generation speed depends on the accelerator, memory bandwidth and model size on the host, not on garak. A quantized model on a CPU-only server and a larger model on a GPU host can differ by a wide margin in time per attempt. Ask the operations team which hardware serves the model, how much memory is free, and whether other workloads share it. Do not copy timings from another host or from a published benchmark. Run a fixed sample of your planned probes on the target host and use that measured rate to plan the full scan window.
Benchmark before you schedule
Because drivers interact, the reliable way to plan duration is a measured pilot on your own hardware. Run a small probe subset with the same generations, options and concurrency you intend to use, record the elapsed time and any queue or load errors, then scale the result to the full probe list. Repeat the pilot after changing a server variable or upgrading garak, since release notes can change how options are passed. Share the measured figures with the team that approves scan windows, so the schedule reflects your environment.
garak releasesCommon failures when garak cannot reach Ollama
This table maps the most common ways a garak scan against Ollama fails to its likely cause and the setting that fixes it. Read each row by matching the error or symptom you see to the cause, then checking the named setting on both the Ollama host and the garak side. Most failures come from host binding, model tag names or request limits rather than from garak itself.
| Failure | Likely cause | Fix |
|---|---|---|
| Connection refused on 127.0.0.1:11434 | Ollama runs on another host, but the generator still uses the default 127.0.0.1:11434 host | Set the host in a generator config file to the Ollama server address and port 11434, and confirm the server is reachable from the scan host |
| Connection refused from a remote scan host | Ollama binds to 127.0.0.1 by default, so it does not accept network connections | Set OLLAMA_HOST on the Ollama server to a bind address reachable from the scan host, or expose it through a proxy such as Nginx |
| Host set but scan still fails | The OLLAMA_HOST value on the server does not match the host or port garak connects to | Compare the bind address on the server with the host in the garak config and correct whichever side differs |
| Model not found | The model name in garak does not match the tag pulled on the Ollama host | List the pulled models on the Ollama host and use the exact name and tag in the garak generator configuration |
| 401 Unauthorized on a cloud route | A cloud endpoint such as ollama.com/api was used without an API key, since the local API at localhost:11434 requires no authentication | Send the API key as a Bearer token through the authentication settings in garak v0.17.0 or later, or switch back to the local endpoint |
| Long generations cut off | A reverse proxy in front of Ollama times out or closes the connection before long completions finish | Raise the proxy read and send timeouts for the Ollama route, then rerun a short probe to confirm complete responses |
| Slow runs, then queued or failed requests | High generation counts per prompt, combined with the default parallel setting of 1 per model and a queue limit of 512 | Lower the generations per prompt for the first pass, or raise OLLAMA_NUM_PARALLEL on the server within the hardware limits and watch queue depth |
| Unexpected parameter behavior | Generation options are not passed through the options dict in garak versions before v0.17.0 | Confirm the garak version with pip, upgrade to v0.17.0 or later, and check that the options dict reaches the server |
Questions teams ask before scanning Ollama models
What does it cost to set up a garak scan against Ollama internally?
Running garak and Ollama is free software, so the cost is staff time and the hardware you already operate. The effort depends on how many Ollama hosts you have, how many models each serves, whether firewall or proxy changes are needed to reach the API from a scan host, and who reviews the JSONL reports afterward. Each of these adds steps, and none is a fixed quantity. Ask your team to inventory hosts and models first, then estimate the review workload before committing time. The Ollama pricing page states that running models on your own hardware is always unlimited, so paid cloud plans are not part of a local scan's cost.
How long does a first garak scan of an Ollama model take?
The duration depends on the model size, the hardware serving it, the probes you select, and how many requests run in parallel. Ollama handles one parallel request per model by default, controlled by OLLAMA_NUM_PARALLEL, so a default configuration runs attempts more slowly than a tuned one. Garak also makes 5 generations per prompt by default, which multiplies the request count. No duration is established for your environment, so benchmark a small probe set on the target host first, measure the time per attempt, and scale from that measurement to the full probe list.
Can our team run a garak scan against Ollama without outside help?
Yes, for a single Ollama host with a pinned garak version, a competent engineer can usually do it with the documentation and the generator source. The work is a pip install of garak on Python 3.11 or newer, a generator config pointing at the host and port, and a test run. Difficulty rises with multiple hosts, authentication requirements, custom generation options, or a need to repeat scans on a schedule and compare results across releases. Pin the garak version in your scan environment so that score changes come from models rather than from tool upgrades.
What do we need to provide for a garak scan of Ollama models?
Four things make the work run smoothly:
- Access to the Ollama host, including the bind address and port (127.0.0.1:11434 by default) and any proxy in front of it
- A scan host with network reach to that endpoint and Python 3.11 or newer
- Network approvals for the connection, plus credentials if you place an authenticating proxy in front of Ollama
- A named owner who receives the JSONL reports, decides what counts as a failure and tracks fixes
The report owner is the most often missing item. Without someone accountable for reading results, a scan produces files that nobody acts on.
Does scanning Ollama models with garak require a paid Ollama plan?
No. Ollama's pricing page states that running models on your own hardware is always unlimited. The paid plans (Pro, Max, Team and Enterprise) cover cloud models and team features such as model access controls and cost budgets. A local scan against a model served from your own Ollama host needs no subscription. Direct cloud inference at ollama.com requires an API key, so if you scan a cloud-hosted model, check the plan terms for that usage. Confirm current pricing directly on the pricing page before budgeting, since plan details can change.
Does local Ollama serving keep our prompts and data inside our network?
Ollama states that when it runs locally it does not see your prompts or data, which matters when scanned prompts include sensitive test content. Cloud features are separate: you can turn them off with OLLAMA_NO_CLOUD=1 or in the server configuration file. Keep the bind address on 127.0.0.1 unless you deliberately expose it. If you do expose it through a proxy such as Nginx, add authentication and network restrictions yourself, because the local API does not require authentication by default. Verify this behavior in your own environment and against your current Ollama version.
Can DeployOpen run the garak scan against our Ollama models and deliver findings?
Yes. DeployOpen runs security testing, including AI system testing, and delivers findings with fixes and a retest on fixed-scope engagements, where scope, deliverables and timelines are agreed in writing before work starts. For an Ollama scan, the scope would cover the hosts and models in question, the probe selection, the environment where scans run, and the report handover. DeployOpen does not issue audit reports or certifications, so scan results serve as testing evidence for your own assessors. A quote follows from the written scope, and DeployOpen does not publish a price list.
How a garak scan reaches a local Ollama model
The scan starts on a host you control, where garak loads the OllamaGenerator with its host and options settings. Each prompt crosses the network to the Ollama REST API on port 11434, which hands the request to the model runtime on the Ollama server. Results return to the scan host as a JSONL report and a continuing garak.log. Check the trust boundary between the two hosts, whether a reverse proxy sits in front of Ollama, and whether any request leaves the network.
Request path from a garak scan host to a local Ollama server across the network boundary.
Confirming versions and settings before you rely on the results
Pin the garak version before the first scan you intend to keep. garak and Ollama both release often, and a score is only meaningful against the tool that produced it. The latest garak release supplied for this page is v0.17.1, published on 16 October 2026, so record that exact version in your scan notes, your CI configuration or your requirements file, and confirm it with garak --version on the host that runs the scan. Scores can shift between garak releases because probes, detectors and evaluation logic change, so treat results from different garak versions as separate series. Compare runs only within a pinned version, and plan a deliberate re-baseline when you upgrade. The changes between releases are covered in the upgrades section.
Record the Ollama version alongside the garak version in every report context. The model's behavior depends on the Ollama runtime, the llama.cpp backend it bundles and the model build pulled into the local store, so a report that names only the model tag cannot be reproduced later. Capture the Ollama server version from the host, for example by querying the server, and store it with the garak JSONL report and the garak.log file. Ollama ships frequent releases, including pre-releases, so pin the server version on the host and do not let an automatic update change it between scans.
Recheck the Ollama environment variables after every upgrade. The settings that govern exposure and load are read from the environment or the server configuration, and an upgrade or a service reinstall can reset them. Confirm that OLLAMA_HOST still binds where you expect, that OLLAMA_NUM_PARALLEL and OLLAMA_MAX_QUEUE match the concurrency you planned, and that OLLAMA_NO_CLOUD=1 is still set if your policy requires local-only inference. Also confirm that OLLAMA_MODELS points to the store you audited. Check these values in the same change window as the version bump, and write the result into the scan record so the next reader knows the setup behind the numbers.
How DeployOpen scopes and delivers an Ollama scan with garak
DeployOpen approaches a garak scan of Ollama models as a fixed-scope engagement inside your network, starting from the models you run and the endpoints your team uses. The work covers the generator setup, the scan plan, the evidence your reviewers need and a handover your team can repeat.
How we scope
- Inventory which Ollama hosts, models and tags are in scope, and where each host runs.
- Agree the probe families, generation settings and failure criteria in writing before any run.
- Confirm who may reach the Ollama API and whether any cloud features must be disabled.
How we build
- Configure the OllamaGenerator or OllamaGeneratorChat with host, options and authentication settings for your environment.
- Run a baseline scan, check the JSONL report and garak.log, and resolve connection or parameter errors.
- Repeat runs with the agreed settings so results can be compared across model versions.
How we hand over
- Deliver the scan configuration files, run commands and a written summary of findings with the report.
- Document host settings, environment variables and model storage locations used during testing.
- Walk your security and platform engineers through reading the results and rerunning the scan.
How we support
- Offer ongoing support as a retainer for rescans after Ollama or garak upgrades.
- Provide continuous testing as a retainer when models or generation options change regularly.
- Confirm support terms, response expectations and included rescans in the written scope.

