# nvidia/garak architecture

> Architecture diagram of the GitHub repository nvidia/garak, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nvidia/garak
- Repository: https://github.com/nvidia/garak

## Overview

garak is an LLM vulnerability scanner: users select a target model and probes, then the toolkit generates adversarial attempts, evaluates responses with detectors, and records reports for later analysis. Its plugin/configuration machinery supports this workflow; language services and intent data add assessment capabilities. A separate React report application presents run data. The graph follows documented behavior and SOURCE INDEX references; unsampled modules are represented by their supported paths, but their internal behavior and unshown connections are not inferred.

Main entry points: [`garak/cli.py`](https://github.com/nvidia/garak/blob/main/garak/cli.py) (CLI commands), [`garak/harnesses`](https://github.com/nvidia/garak/tree/main/garak/harnesses) (Harness execution), [`garak/command.py`](https://github.com/nvidia/garak/blob/main/garak/command.py) (Run orchestration), [`garak/probes/base.py`](https://github.com/nvidia/garak/blob/main/garak/probes/base.py) (Probe plugins)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and selection"]
  node_cli["CLI commands<br/>[cli.py]"]
  node_config["Run configuration<br/>[_config.py]"]
  node_selection["Probe selection<br/>[_selection.py]"]
  node_spec["Run specs<br/>[_spec.py]"]
  node_plugins["Plugin registry<br/>[_plugins.py]"]
end

subgraph group_runtime["Scan execution"]
  node_command["Run orchestration<br/>[command.py]"]
  node_harness["Harness execution"]
  node_probes["Probe plugins<br/>[base.py]"]
  node_generator["Model generators<br/>[base.py]"]
  node_attempt["Attempt records<br/>[attempt.py]"]
  node_buffs["Prompt buffs"]
end

subgraph group_assessment["Assessment services"]
  node_detectors["Vulnerability detectors"]
  node_evaluator["Result evaluation<br/>[base.py]"]
  node_intent["Intent service<br/>[intentservice.py]"]
  node_langservice["Language service<br/>[langservice.py]"]
  node_langproviders["Language providers<br/>[base.py]"]
end

subgraph group_results["Reports and analysis"]
  node_report["Run reports<br/>[report.py]"]
  node_analysis["Report analysis"]
end

subgraph group_viewer["Report application"]
  node_report_ui["Report viewer<br/>[Report.tsx]"]
  node_app["Theme app shell<br/>[App.tsx]"]
end

node_user(("CLI user"))

node_user -->|"chooses scan"| node_cli
node_cli -->|"loads settings"| node_config
node_cli -->|"selects plugins"| node_selection
node_cli -->|"parses specs"| node_spec
node_cli -->|"starts run"| node_command
node_config -->|"builds legacy spec"| node_spec
node_spec -->|"resolves probe tiers"| node_probes
node_command -->|"loads plugins"| node_plugins
node_command -->|"dispatches run"| node_harness
node_command -->|"uses intent service"| node_intent
node_command -->|"uses report digest"| node_analysis
node_harness -->|"runs probes"| node_probes
node_harness -->|"processes attempts"| node_attempt
node_probes -->|"creates attempts"| node_attempt
node_generator -->|"uses attempts"| node_attempt
node_probes -->|"uses translation service"| node_langservice
node_langservice -->|"loads providers"| node_langproviders
node_intent -->|"reads intent specs"| node_spec
node_intent -->|"checks detector mapping"| node_detectors
node_evaluator -->|"evaluates attempts"| node_attempt
node_evaluator -->|"uses metrics"| node_analysis
node_harness -.->|"queries target"| node_generator
node_harness -.->|"evaluates with"| node_detectors
node_harness -.->|"applies buffs"| node_buffs
node_cli -.->|"writes run report"| node_report
node_app -->|"renders viewer"| node_report_ui
node_user -.->|"reviews results"| node_report_ui

click node_cli "https://github.com/nvidia/garak/blob/main/garak/cli.py"
click node_config "https://github.com/nvidia/garak/blob/main/garak/_config.py"
click node_selection "https://github.com/nvidia/garak/blob/main/garak/_selection.py"
click node_spec "https://github.com/nvidia/garak/blob/main/garak/_spec.py"
click node_plugins "https://github.com/nvidia/garak/blob/main/garak/_plugins.py"
click node_command "https://github.com/nvidia/garak/blob/main/garak/command.py"
click node_harness "https://github.com/nvidia/garak/tree/main/garak/harnesses"
click node_probes "https://github.com/nvidia/garak/blob/main/garak/probes/base.py"
click node_generator "https://github.com/nvidia/garak/blob/main/garak/generators/base.py"
click node_attempt "https://github.com/nvidia/garak/blob/main/garak/attempt.py"
click node_buffs "https://github.com/nvidia/garak/tree/main/garak/buffs"
click node_detectors "https://github.com/nvidia/garak/tree/main/garak/detectors"
click node_evaluator "https://github.com/nvidia/garak/blob/main/garak/evaluators/base.py"
click node_intent "https://github.com/nvidia/garak/blob/main/garak/services/intentservice.py"
click node_langservice "https://github.com/nvidia/garak/blob/main/garak/services/langservice.py"
click node_langproviders "https://github.com/nvidia/garak/blob/main/garak/langproviders/base.py"
click node_report "https://github.com/nvidia/garak/blob/main/garak/report.py"
click node_analysis "https://github.com/nvidia/garak/tree/main/garak/analyze"
click node_report_ui "https://github.com/nvidia/garak/blob/main/garak-report/src/pages/Report.tsx"
click node_app "https://github.com/nvidia/garak/blob/main/garak-report/src/App.tsx"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_config,node_selection,node_spec,node_plugins,node_user toneBlue
class node_command,node_harness,node_probes,node_generator,node_attempt,node_buffs toneAmber
class node_detectors,node_evaluator,node_intent,node_langservice,node_langproviders toneMint
class node_report,node_analysis toneRose
class node_report_ui,node_app toneIndigo
```

## Components

### CLI and selection

- [CLI commands](https://github.com/nvidia/garak/blob/main/garak/cli.py): `garak/cli.py`
- [Run configuration](https://github.com/nvidia/garak/blob/main/garak/_config.py): `garak/_config.py`
- [Probe selection](https://github.com/nvidia/garak/blob/main/garak/_selection.py): `garak/_selection.py`
- [Run specs](https://github.com/nvidia/garak/blob/main/garak/_spec.py): `garak/_spec.py`
- [Plugin registry](https://github.com/nvidia/garak/blob/main/garak/_plugins.py): `garak/_plugins.py`

### Scan execution

- [Run orchestration](https://github.com/nvidia/garak/blob/main/garak/command.py): `garak/command.py`
- [Harness execution](https://github.com/nvidia/garak/tree/main/garak/harnesses): `garak/harnesses`
- [Probe plugins](https://github.com/nvidia/garak/blob/main/garak/probes/base.py): `garak/probes/base.py`
- [Model generators](https://github.com/nvidia/garak/blob/main/garak/generators/base.py): `garak/generators/base.py`
- [Attempt records](https://github.com/nvidia/garak/blob/main/garak/attempt.py): `garak/attempt.py`
- [Prompt buffs](https://github.com/nvidia/garak/tree/main/garak/buffs): `garak/buffs`

### Assessment services

- [Vulnerability detectors](https://github.com/nvidia/garak/tree/main/garak/detectors): `garak/detectors`
- [Result evaluation](https://github.com/nvidia/garak/blob/main/garak/evaluators/base.py): `garak/evaluators/base.py`
- [Intent service](https://github.com/nvidia/garak/blob/main/garak/services/intentservice.py): `garak/services/intentservice.py`
- [Language service](https://github.com/nvidia/garak/blob/main/garak/services/langservice.py): `garak/services/langservice.py`
- [Language providers](https://github.com/nvidia/garak/blob/main/garak/langproviders/base.py): `garak/langproviders/base.py`

### Reports and analysis

- [Run reports](https://github.com/nvidia/garak/blob/main/garak/report.py): `garak/report.py`
- [Report analysis](https://github.com/nvidia/garak/tree/main/garak/analyze): `garak/analyze`

### Report application

- [Report viewer](https://github.com/nvidia/garak/blob/main/garak-report/src/pages/Report.tsx): `garak-report/src/pages/Report.tsx`
- [Theme app shell](https://github.com/nvidia/garak/blob/main/garak-report/src/App.tsx): `garak-report/src/App.tsx`

### Other components

- **CLI user**

## Connections

- CLI user → CLI commands: chooses scan (evidence: `README.md`)
- CLI commands → Run configuration: loads settings (evidence: `garak/cli.py`)
- CLI commands → Probe selection: selects plugins (evidence: `garak/cli.py`)
- CLI commands → Run specs: parses specs (evidence: `garak/cli.py`)
- CLI commands → Run orchestration: starts run (evidence: `garak/cli.py`)
- Run configuration → Run specs: builds legacy spec (evidence: `garak/_config.py`)
- Run specs → Probe plugins: resolves probe tiers (evidence: `garak/_spec.py`)
- Run orchestration → Plugin registry: loads plugins (evidence: `garak/command.py`)
- Run orchestration → Harness execution: dispatches run (evidence: `garak/command.py`)
- Run orchestration → Intent service: uses intent service (evidence: `garak/command.py`)
- Run orchestration → Report analysis: uses report digest (evidence: `garak/command.py`)
- Harness execution → Probe plugins: runs probes (evidence: `garak/harnesses/base.py`)
- Harness execution → Attempt records: processes attempts (evidence: `garak/harnesses/base.py`)
- Probe plugins → Attempt records: creates attempts (evidence: `garak/probes/base.py`)
- Model generators → Attempt records: uses attempts (evidence: `garak/generators/base.py`)
- Probe plugins → Language service: uses translation service (evidence: `garak/probes/base.py`)
- Language service → Language providers: loads providers (evidence: `garak/services/langservice.py`)
- Intent service → Run specs: reads intent specs (evidence: `garak/services/intentservice.py`)
- Intent service → Vulnerability detectors: checks detector mapping (evidence: `garak/services/intentservice.py`)
- Result evaluation → Attempt records: evaluates attempts (evidence: `garak/evaluators/base.py`)
- Result evaluation → Report analysis: uses metrics (evidence: `garak/evaluators/base.py`)
- Harness execution → Model generators: queries target
- Harness execution → Vulnerability detectors: evaluates with
- Harness execution → Prompt buffs: applies buffs
- CLI commands → Run reports: writes run report (evidence: `garak/cli.py`)
- Theme app shell → Report viewer: renders viewer (evidence: `garak-report/src/App.tsx`)
- CLI user → Report viewer: reviews results
