Multi-model · Prompt Injection Guard (302.8 MB) → BERT-Small PII (28.75 MB) · 331.55 MB · Apache-2.0

2-layer pre-LLM gate: injection guard → PII scrubber

Before a prompt (or the RAG context stuffed into it) reaches any LLM, Stage 1 (Horizon-Labs/prompt-injection-guard-small) blocks or quarantines instructions aimed at the AI, and Stage 2 reuses the built onnx-community/bert-small-pii-detection-ONNX worker to redact names, emails, phones and addresses — producing the exact scrubbed prompt you would forward. Both models run in separate workers on this device.

1. Two local models (~331.55 MB combined)

Stage 1 · Prompt injection guard

Horizon-Labs/prompt-injection-guard-small · 302.8 MB WASM q8 · Apache-2.0

Stage 2 · PII scrubber

Reuses ../bert-small-pii-detection/worker.js · onnx-community/bert-small-pii-detection-ONNX · 28.75 MB WASM q8 · Apache-2.0

0.50
0.50

2. Gateway decision & scrubbed prompt

Awaiting both stages Initialise both models, then run the gate.
Stage 1 P(INJECTION)–
Injected sentences–
Stage 2 PII spans–
Leak check–
Latency (S1 / S2)–
NaN check–

Stage 1 · injection highlights

sentence windows

Run Stage 1 to mark injected sentences.

Stage 2 · PII spans

49 BIO labels
  • Run Stage 2 to list detected PII spans.

Safe prompt preview (what would be forwarded)

–
Run both stages to build the scrubbed prompt.

3. Inspect the gateway logic

Show the code · guard-core.mjs — gatewayDecision() BLOCK / SANITIZE / ALLOW
Show the code · bert-small-pii-detection/worker.js — reused Stage 2 token classification