Skip to content
Enterprise Beta

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 IDArchitectureTypical LatencyRAM FootprintProvider
prompt-guardMeta PromptGuard (86M)12–18 ms~250 MBDocker Sidecar (ghcr.io/faradailab/prompt-guard:latest)
llama-guard3:1bLlama Guard 3 (1B Q4)22–35 ms~1.1 GBLocal Ollama
qwen3guard-0.6bQwen 2.5 Guard (0.6B)15–25 ms~600 MBOllama / MLX / vLLM
granite-guardianIBM Granite 3.0 (2B)30–45 ms~1.8 GBOllama

Quick Setup: Starting a Local Guard Engine

  1. Install Ollama.
  2. Pull the lightweight guard model:
    Terminal window
    ollama pull llama-guard3:1b
  3. FaradAiWire will automatically discover and link it on startup.
Terminal window
docker run -d -p 8088:8088 --name prompt-guard ghcr.io/faradailab/prompt-guard:latest

Verifying & Managing Guards via CLI

FaradAiWire provides dedicated subcommands to inspect and manage inference engines:

Diagnose Providers:

Terminal window
faradaiwire doctor

Discovers running Ollama or Docker endpoints and tests round-trip inference latency.

List Installed Models:

Terminal window
faradaiwire guard list
AVAILABLE 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 AVAILABLE

Check Active Guard Status:

Terminal window
faradaiwire guard status

Configuration

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-path

Visualizing 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.