Garak

Security & Safety 💻 Python ⚖️ Apache-2.0 🟢 Actively maintained
9.1k stars

Garak is a free, open-source command-line tool for scanning large language models (LLMs) for security vulnerabilities such as hallucination, data leakage, prompt injection, and jailbreaks. It is designed for developers and security researchers who want to assess the robustness of their LLM applications.

✨ Key features

  • Probes for hallucination, data leakage, prompt injection, and more
  • Supports Hugging Face, OpenAI, Replicate, AWS Bedrock, and more
  • Static, dynamic, and adaptive probes
  • Command-line interface with progress bars and detailed logs
  • Extensible plugin system for custom probes and generators

🎯 Use cases

  • Red-teaming LLM-based applications before deployment
  • Comparing vulnerability of different models or versions
  • Testing specific attack types like DAN or encoding injection
  • Integrating security scanning into CI/CD pipelines

📦 Installation

🧰 Requirements: Python 3.11-3.13, Linux or macOS, and API keys for cloud-based models (e.g., OpenAI, Replicate) as needed.

python -m pip install -U garak

For development version:

python -m pip install -U git+https://github.com/NVIDIA/garak.git@main

Or clone from source:

conda create --name garak "python>=3.11,<=3.13"
conda activate garak
gh repo clone NVIDIA/garak
cd garak
python -m pip install -e .

🚀 Usage

Probe a Hugging Face model for DAN 11.0
python3 -m garak --target_type huggingface --target_name gpt2 --spec probes.dan.Dan_11_0
Probe an OpenAI model for encoding-based prompt injection · Set OPENAI_API_KEY first
export OPENAI_API_KEY="sk-123XXXXXXXXXXXX"
python3 -m garak --target_type openai --target_name gpt-5-nano --spec probes.encoding

❓ FAQ

What LLMs does garak support?

It supports Hugging Face generative models, OpenAI chat and continuation models, Replicate text models, AWS Bedrock foundation models, Cohere, Groq, ggml models, REST endpoints, and NIM endpoints.

How do I specify which probes to run?

Use the --spec option with a probe family (e.g., probes.promptinject) or a specific plugin (e.g., probes.lmrc.SlurUsage). By default, all probes are run.

What do the results mean?

For each probe, garak prints a progress bar and then a row with detector results. If any prompt attempt yields undesirable behavior, the response is marked FAIL with a failure rate.

Where can I find more documentation?

The user guide is at docs.garak.ai, and project links are at garak.ai. You can also join the Discord for help.

📊 Repository

Stars★ 9,119
Forks🍴 1,246
Open issues🐛 410
Last commit🕒 Sep 4, 2026
Created📅 May 2023
Language💻 Python
License⚖️ Apache-2.0

🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.