Intermediate 12 minDaily plan

Garak LLM: auditing your model's security local

BestLLMfor — Garak — Audit your local LLM

Garak is an open-source scanner, maintained by NVIDIA, that sends a model series of attack prompts (injection, jailbreaks, encodings, training data leakage, etc.) and classifies the responses with automated detectors. This guide shows you how to run a limited garak LLM audit on a model served by Ollama on your machine, then how to read the alerts without overinterpreting them. It contains no scan results: outputs depend on the model, its quantization, the garak version, and sampling randomness, and it's up to you to produce and assess them.

By Mohamed Meguedmi·Update 2026-11-30·Tested on Windows, macOS, and Linux

#What garak tests, and what it doesn't

The name garak comes from “Generative AI Red-teaming & Assessment Kit.” The official documentation (docs.garak.ai, accessed 30/10/2026) describes it as a tool that looks for ways to make an LLM or dialogue system fail: hallucinations, data leakage, prompt injection, misinformation, toxic content generation, and guardrail bypasses. The code is published on GitHub in the NVIDIA/garak repository under the Apache 2.0 license, and the approach is described in a research paper (Derczynski et al., “garak: A Framework for Security Probing Large Language Models,” arXiv 2406.11036, 2024).

It works through three building blocks you need to know to understand a report:

Generator
The connector to the model under test: Hugging Face, OpenAI-compatible API, Ollama, generic REST, and so on. It sends the prompts and retrieves the responses.
Probe
A family of attacks: for example encoding (instructions hidden in Base64, ROT13, etc.), promptinject, dan ("Do Anything Now"-style jailbreaks), leakreplay (reproduction of training text), latentinjection, packagehallucination (made-up software packages). Each probe generates attempts.
Detector
An automated judge that reads each response and decides whether the attack succeeded. Depending on the case, it's a string search, a regular expression, or a classifier. It's the most error-prone link, as covered below.
Harness
The orchestration: which probes, with which detectors, how many generations per prompt. The default harness pairs each probe with its recommended detectors.

Garak tests a model behind an endpoint. It doesn't see your application: not the RAG connected to Open WebUI, not the tools an agent can call, not the permissions of the account running Ollama, and not the network exposure of port 11434. Those risks fall under other controls, detailed in our OWASP Top 10 LLM guide. Garak complements that framework on one specific point: how the model itself reacts to known hostile inputs.

#Scope: a model you own or written authorization

The complete kit for building your own AI assistant.

Benefit from our experience and a guided path to build your local assistant and use your AI every day.

  • Lifetime online access
  • PDF + files
  • Refunded within 30 days

A garak scan means hundreds to thousands of requests designed to trigger unintended behavior. Run against a service you don't control, it can violate the terms of service, trigger account suspensions, rack up a large API bill, and, depending on the context, cross legal lines. This guide therefore deliberately sticks to a simple scope: an open-weight model downloaded and served on your own machine.

!
Audit scope
Only target models you host yourself, or a service for which you have explicit written authorization (scope, dates, request volume, incident contact). A shared Ollama at the office is not "your" model: get approval from the person who administers it before hitting it with thousands of prompts.

A second framing point: some probes push the model to produce toxic content, dangerous instructions, or malicious code. These outputs are saved in plain text in the report files. Keep them on the audit machine, don't publish them as is, and delete them once the analysis is complete.

#Prerequisites

Python
garak installs as a Python package. The supported version range changes over time: check it in the documentation or on the package's PyPI page before installing. A dedicated virtual environment avoids conflicts between its many dependencies (PyTorch, transformers, etc.).
Ollama running
By default, it listens on http://localhost:11434. The model to audit must be downloaded (ollama pull) before the scan.
A reasonably sized model
A scan runs through a lot of generations. Start with a small model to validate the pipeline: a 3B in Q4_K_M takes about 2 GB of VRAM, a 7B about 5 GB. A 14B (≈9 GB in Q4) still fits comfortably on a 12 GB RTX 3060 or 4070.
Disk space
Plan for several gigabytes: garak's Python dependencies are heavy, and some detectors download classification models from Hugging Face on first use.
Some time
A full scan with all default probes can take hours on a consumer GPU. This guide uses selected probes, which keeps the run time under control.

#Install garak in an isolated environment

The documentation describes installing via pip. Do it in a virtual environment, not in the system Python:

Terminal
python3 -m venv ~/venvs/garak
source ~/venvs/garak/bin/activate
python -m pip install -U garak

# Vérifier que l'outil répond et voir les options de VOTRE version
python -m garak --help

Read the --help output carefully. Garak moves fast and some options get renamed from one version to the next: depending on the installed version, the target model setting appears as --model_type / --model_name or as --target_type / --target_name. The commands below use the first form; swap it out if your help output shows the second.

Next, explore the catalog. These three commands list what your version actually includes, which beats any list copied from an article:

Terminal
python -m garak --list_generators
python -m garak --list_probes
python -m garak --list_detectors

In the probe list, a family entry (for example, encoding) groups several specific probes (encoding.InjectBase64, encoding.InjectHex…). Some probes are marked inactive by default, often because they're slow or require special configuration: they only run if you name them explicitly.

#Connect Ollama and run a limited scan

Garak has a Ollama generator. If your version doesn't list it in --list_generators, you can still use the OpenAI-compatible generator pointed at http://localhost:11434/v1, with an options file as described in the documentation. The procedure below assumes the Ollama generator.

  1. 01
    1. Prepare the model and note its exact version
    Download the model with its full tag (for example llama3.2:3b, which corresponds to Q4_K_M quantization in the Ollama library). Record the tag, the date, and the output of ollama show: an audit only means something when it's tied to a specific artifact. The same model in Q8_0 or FP16 may respond differently.
  2. 02
    2. Validate the pipeline with a neutral probe
    Garak provides a test probe, test.Blank, that sends an empty prompt. It doesn't measure anything; it's used to confirm that garak can reach Ollama, that the model loads, and that a report gets written.
  3. 03
    3. Choose two or three probe families relevant to your use case
    An assistant that reads external documents is primarily exposed to indirect injections (latentinjection, promptinject) and encoded instructions (encoding). A coding assistant is affected by packagehallucination. There's no need to run everything: a targeted scan you can actually analyze is better than an exhaustive report nobody will read.
  4. 04
    4. Run with few generations
    The --generations option sets the number of responses requested per prompt. A low value gives you a quick first look; then increase it on the probes you care about to reduce the effect of randomness.
  5. 05
    5. Preserve the scan context
    Keep the exact command, the garak version (pip show garak), the Ollama version (ollama --version), the model tag, and the Modelfile if it was customized. Without this information, one report can't be compared with the next.
Terminal — setting up and testing the pipeline
# Le modèle à auditer (exemple : un 3B, environ 2 Go en Q4)
ollama pull llama3.2:3b
curl -s http://localhost:11434/api/tags | head -c 300; echo

# Contexte à archiver avec le rapport
pip show garak | grep -i '^version'
ollama --version
ollama show llama3.2:3b

# Sonde neutre : vérifie seulement la connexion et l'écriture du rapport
python -m garak --model_type ollama --model_name llama3.2:3b --probes test.Blank
Terminal — scan limited to a few probes
python -m garak \
  --model_type ollama \
  --model_name llama3.2:3b \
  --probes encoding.InjectBase64,promptinject \
  --generations 3 \
  --report_prefix audit-llama32-3b-q4

While running, garak shows a progress bar for each probe and then, for each probe/detector pair, a summary line with a status and the ratio of responses judged correct. At the end of the run, it prints the path to the output files. Note this path: it depends on your system and configuration (on Linux, it is usually under ~/.local/share/garak/).

→
Don't test a model other than the one in production
If you actually use a custom Modelfile (system prompt, temperature, template), audit that model, under its custom name. A well-written system prompt, or a sloppy one, significantly changes how the model reacts to injections. Auditing the "bare" model and then deploying a variant means you're testing something other than what's actually running.

#Reading the garak LLM report

A run produces several files sharing the same prefix. The exact names may vary by version, but you'll generally find:

JSONL report (.report.jsonl)
The full log: run configuration, each attempt with the prompt sent, the responses received, and the detector scores, followed by the aggregated evaluations. This is the source of truth.
HTML report (.report.html)
A summary viewable in a browser, grouped by probe and by detector. Handy for initial triage, but not enough to draw conclusions.
Hitlog (.hitlog.jsonl)
Only the attempts that detectors classified as successful for the attacker. This is where you start the analysis.

The habit to build: never stop at the percentage. Open the hitlog and read the flagged prompts and responses. Start by looking at the structure of a line, then count the alerts per probe and per detector. Adjust the field names to what your file actually contains.

Terminal — inspecting the hitlog with jq
# Adapter le chemin à celui affiché en fin de run
HITLOG=~/.local/share/garak/garak_runs/audit-llama32-3b-q4.hitlog.jsonl

# 1. Voir les champs disponibles sur la première alerte
head -n 1 "$HITLOG" | jq .

# 2. Compter les alertes par couple sonde / détecteur
jq -r '[.probe, .detector] | @tsv' "$HITLOG" | sort | uniq -c | sort -rn

# 3. Lire quelques réponses brutes (tronquées à 300 caractères)
jq -r '.output | tostring | .[0:300]' "$HITLOG" | head -n 20

For each alert you review, ask three questions. Does the response really show that the model followed the malicious instruction, or did the detector react to a single word? Would the behavior be a problem in your actual use? Does the alert come back if you rerun the same probe? This manual triage is the useful part of the audit; the overall score is just a starting point.

#Alerts, false positives, and false negatives

garak's detectors are heuristics. The documentation itself presents them as automated classification tools, not infallible judges. Several typical situations skew the results in a local, French-language context:

Unrecognized refusal
Some detectors look for refusal or warning phrases in English. A model that politely refuses in French may not be recognized as having refused, and the attempt is then counted against it. Read the response before drawing conclusions.
Overly broad string matching
A detector that looks for a trigger word (the decoded text of a Base64 payload, for example) also flags a model that quotes that word to explain it won't follow the instruction. This is a classic false positive.
Imperfect classifiers
Toxicity detectors rely on classification models trained mostly on English. On responses in French or mixing code and text, they make errors more often.
Sampling randomness
With a nonzero temperature, two identical runs don't produce the same responses. A single alert across three generations may disappear on the next run, and vice versa. Increase --generations on the probes that matter and compare several runs.
False negatives
A successful attack phrased differently than expected (a paraphrase, another language, a partial response) can slip past the detector. A "PASS" line means the detector saw nothing, not that nothing happened.

In practice, sort each alert you review into one of these categories: confirmed (the model actually followed the attack), false positive (the detector got it wrong), or ambiguous (rerun with more generations). Only confirmed alerts that are relevant to your use case warrant action: hardening the system prompt, switching models, adding an input or output filter such as Llama Guard or Granite Guardian, or restricting what the application lets the model do.

#Why a passing scan proves nothing

!
No alert ≠ secure
A model that passes a few garak probes has only withstood those specific prompts, as judged by those specific detectors, over that number of generations, in that version. It is not a certification, not a guarantee, and not sufficient grounds for exposing a service. Never call a model "secure" based on a scan.

The reasons are structural. The probes reproduce known, published attacks; a motivated attacker crafts their own. Models change: a new version, a different quantization (Q4_K_M, Q5_K_M, Q8_0, FP16), or a different chat template can alter the responses. The scan targets the model in isolation, whereas most real-world incidents come from how things are put together: untrusted documents injected into the context by a RAG pipeline, tools called without confirmation, port Ollama exposed on the network without authentication.

Garak therefore fits best as a regression and comparison tool: checking that a change of model, quantization, or system prompt hasn't degraded resistance to a fixed battery of probes. For this use, pin the garak version, the probe list, the number of generations, and the model, then compare runs performed under the same conditions. Differences should be read case by case, not summarized into a score.

On QuelLLM, we have not published any garak scan results: none of the figures in this guide come from an actual audit. If you share your own, include the garak version, the command, the model and its quantization, the hardware, the date, and the JSONL report; otherwise, no one will be able to reproduce them.

#Troubleshooting

Unknown option (--model_type or --target_type)
Your version uses the other naming. Check python -m garak --help and adjust the command.
Connection error to localhost:11434
Ollama isn't running, is listening on a different address (OLLAMA_HOST variable), or is running in a container with no published port. Check with curl http://localhost:11434/api/tags before rerunning garak.
Model not found
The name you pass to garak must exactly match the tag shown by ollama list, including the suffix (llama3.2:3b, not llama3.2).
Never-ending scan
You probably launched all the default probes. Interrupt with Ctrl+C, name two or three probes explicitly, and lower --generations. Also check with ollama ps that the model runs entirely on the GPU: spilling over to the CPU slows every generation considerably.
Unexpected downloads on first launch
Some detectors fetch a classification model from Hugging Face. On an air-gapped machine, prepare these models in advance or stick to probes whose detectors use string matching.
Python dependency conflicts
Create a fresh, clean virtual environment dedicated to garak instead of installing it alongside other AI tools.

#Go further

Garak covers how the model reacts to hostile inputs. For a complete approach to local AI, pair it with a risk matrix that covers the entire application, a properly secured Ollama server, and regression tests on your own business prompts.

OWASP Top 10 LLM applied locally
The full risk matrix (injection, data leakage, excessive agency…) and what self-hosting does or doesn't solve. Garak covers only part of it.
Secure your Ollama server
Authentication, reverse proxy, network exposure: the vulnerabilities garak can't see.
Promptfoo and Ollama
To turn your business use cases into reproducible tests, alongside garak's generic probes.
Did this guide help you?

Feedback, an error, or a clarification? Let us know—it improves the guide for everyone.