Neural Prompt Injection Guard
Neural Prompt Injection Guard 🛡️
While regex and static heuristics intercept known exploit signatures in < 1 ms, sophisticated indirect prompt injections and jailbreak attacks require semantic evaluation. FaradAiWire provides an extensible Neural Semantic Security Guard (ADR-0032 & ADR-0042) powered by local Small Language Models (SLMs).
graph LR ToolCall["Tool Call Arguments"] --> FastHeuristics["Static Heuristics (<1ms)"] FastHeuristics -->|"Ambiguous / Untrusted"| Probe["Dual SLM Probe Engine"] Probe -->|"REST / OpenAI API"| Sidecar["Docker Sidecar (:8088)\n(Prompt-Guard)"] Probe -->|"Ollama API"| Ollama["Local Ollama (:11434)\n(Llama-Guard-3:1b)"] Probe -->|"Unix Socket / IPC"| MLX["Local Apple Silicon MLX\n(Qwen3Guard-0.6B)"]
Sidecar --> Score{"Score >= 0.85?"} Ollama --> Score MLX --> Score Score -->|"Yes"| Block["Block Call (-32004)"] Score -->|"No"| Allow["Allow Upstream"]Supported SLM Models & Engines
FaradAiWire interfaces with local inference engines running on developer workstations with zero cloud API keys:
| Model ID | Architecture | Typical Latency | RAM Footprint | Provider |
|---|---|---|---|---|
prompt-guard | Meta PromptGuard (86M) | 12–18 ms | ~250 MB | Docker Sidecar (ghcr.io/faradailab/prompt-guard:latest) |
llama-guard3:1b | Llama Guard 3 (1B Q4) | 22–35 ms | ~1.1 GB | Local Ollama |
qwen3guard-0.6b | Qwen 2.5 Guard (0.6B) | 15–25 ms | ~600 MB | Ollama / MLX / vLLM |
granite-guardian | IBM Granite 3.0 (2B) | 30–45 ms | ~1.8 GB | Ollama |
Quick Setup: Starting a Local Guard Engine
Option A: Local Ollama (Recommended for macOS & Linux)
- Install Ollama.
- Pull the lightweight guard model:
Terminal window ollama pull llama-guard3:1b - FaradAiWire will automatically discover and link it on startup.
Option B: Docker Sidecar (Recommended for Containerized Environments)
docker run -d -p 8088:8088 --name prompt-guard ghcr.io/faradailab/prompt-guard:latestVerifying & Managing Guards via CLI
FaradAiWire provides dedicated subcommands to inspect and manage inference engines:
Diagnose Providers:
faradaiwire doctorDiscovers running Ollama or Docker endpoints and tests round-trip inference latency.
List Installed Models:
faradaiwire guard listAVAILABLE SLM MODELS: ID NAME PROVIDER PARADIGM STATUS prompt-guard-docker Meta PromptGuard docker Classification READY (8088) llama-guard3:1b Llama Guard 3 1B ollama DecisionModel READY (11434) qwen3guard-0.6b Qwen3 Guard 0.6B ollama DecisionModel AVAILABLECheck Active Guard Status:
faradaiwire guard statusConfiguration
In config.yaml:
filters: guard: enabled: true discovery: mode: "auto" # "auto" (dual probe), "ollama", "docker", or "custom" ollama_url: "http://127.0.0.1:11434" docker_url: "http://127.0.0.1:8088" custom_url: "" # Optional OpenAI-compatible endpoint (e.g. vLLM) confidence_threshold: 0.85 # Confidence score (0.00 to 1.00) required to trigger block timeout_ms: 1500 # Fallback timeout before failing closed or passing to fast-pathVisualizing Guard Decisions in the Web Console
Open http://localhost:8095/admin/dashboard and click the Guards tab:
- Interactive Playground: Test arbitrary prompt injection payloads against your active local SLM to observe confidence scores and latency breakdowns.
- Hardware Telemetry Bar: Real-time host CPU, RAM, and GPU memory usage.
- GQA KV Cache Calculator: Accurately estimates memory requirements when scaling context windows from 2K to 8K tokens.