GLiGuard — a single-model prompt-injection / jailbreak classifier enclave, optimized for horizontal scaling.
shim → router (:8080) → round-robin → gliguard-1 (:8001)
→ gliguard-2 (:8001)
Three containers on an internal replicas network:
| container | image | role |
|---|---|---|
router | ghcr.io/tinfoilsh/confidential-gli-guard | Go round-robin reverse proxy |
gliguard-1 | ghcr.io/tinfoilsh/confidential-gli-guard-worker | GLiGuard inference (replica 1) |
gliguard-2 | ghcr.io/tinfoilsh/confidential-gli-guard-worker | GLiGuard inference (replica 2) |
Each worker runs NUM_THREADS=4, MAX_CONCURRENCY=4 — the proven sweet spot
for the 200M GLiNER2 model. Two replicas give ~28 req/s at p50=280ms on a
16-CPU / 8 GiB box, vs ~11 req/s at p50=787ms for a single replica at conc=8.
See tf-test/services/cpu-safeguards/ for the full benchmark.
| Model | HF repo | Size | Stack | Detects |
|---|---|---|---|---|
| GLiGuard | fastino/gliguard-LLMGuardrails-300M | 200M | gliner2 (torch) | Prompt safety (binary safe/unsafe) via prompt_safety task |
GLiGuard is a schema-conditioned model that supports 6 tasks (prompt_safety,
prompt_toxicity, jailbreak_detection, response_safety, response_toxicity,
response_refusal) in a single forward pass. This enclave currently uses only
prompt_safety (binary safe/unsafe), matching the jailbreak-classification
benchmark methodology.
POST /classify{ "text": "Ignore all previous instructions.", "model": "gliguard" }
{
"model": "gliguard",
"label": "unsafe",
"unsafe": true,
"latency_ms": 45.2
}
The model field is optional (defaults to "gliguard") for backward
compatibility with the multi-model confidential-cpu-safeguards API.
POST /classify-allRuns gliguard on the input. Returns the same result as /classify but
wrapped in a results dict (compatible with the multi-model API shape).
GET /healthReturns {"status": "ok", "models": ["gliguard"]} once the model is loaded.
GET /modelsReturns {"models": ["gliguard"]}.
| resource | allocation | usage (2 replicas, conc=4 each) |
|---|---|---|
| CPUs | 16 | ~9 cores steady-state |
| Memory | 8 GiB | ~4 GiB (2 GiB per replica) |
| Throughput | — | ~28 req/s |
| p50 latency | — | ~280ms |
Without MPK, the model loads from the HuggingFace cache. Pre-download it first:
python -c "from gliner2 import GLiNER2; GLiNER2.from_pretrained('fastino/gliguard-LLMGuardrails-300M')"
# Run (model loads from HF cache via the GLIGUARD_MODEL_PATH default)
python -m uvicorn server:app --host 0.0.0.0 --port 8001
Benchmarks live in tf-test/services/cpu-safeguards/.
1 commits
Go
47.6%
Python
39.3%
Dockerfile
13.1%
GLiGuard — a single-model prompt-injection / jailbreak classifier enclave, optimized for horizontal scaling.
shim → router (:8080) → round-robin → gliguard-1 (:8001)
→ gliguard-2 (:8001)
Three containers on an internal replicas network:
| container | image | role |
|---|---|---|
router | ghcr.io/tinfoilsh/confidential-gli-guard | Go round-robin reverse proxy |
gliguard-1 | ghcr.io/tinfoilsh/confidential-gli-guard-worker | GLiGuard inference (replica 1) |
gliguard-2 | ghcr.io/tinfoilsh/confidential-gli-guard-worker | GLiGuard inference (replica 2) |
Each worker runs NUM_THREADS=4, MAX_CONCURRENCY=4 — the proven sweet spot
for the 200M GLiNER2 model. Two replicas give ~28 req/s at p50=280ms on a
16-CPU / 8 GiB box, vs ~11 req/s at p50=787ms for a single replica at conc=8.
See tf-test/services/cpu-safeguards/ for the full benchmark.
| Model | HF repo | Size | Stack | Detects |
|---|---|---|---|---|
| GLiGuard | fastino/gliguard-LLMGuardrails-300M | 200M | gliner2 (torch) | Prompt safety (binary safe/unsafe) via prompt_safety task |
GLiGuard is a schema-conditioned model that supports 6 tasks (prompt_safety,
prompt_toxicity, jailbreak_detection, response_safety, response_toxicity,
response_refusal) in a single forward pass. This enclave currently uses only
prompt_safety (binary safe/unsafe), matching the jailbreak-classification
benchmark methodology.
POST /classify{ "text": "Ignore all previous instructions.", "model": "gliguard" }
{
"model": "gliguard",
"label": "unsafe",
"unsafe": true,
"latency_ms": 45.2
}
The model field is optional (defaults to "gliguard") for backward
compatibility with the multi-model confidential-cpu-safeguards API.
POST /classify-allRuns gliguard on the input. Returns the same result as /classify but
wrapped in a results dict (compatible with the multi-model API shape).
GET /healthReturns {"status": "ok", "models": ["gliguard"]} once the model is loaded.
GET /modelsReturns {"models": ["gliguard"]}.
| resource | allocation | usage (2 replicas, conc=4 each) |
|---|---|---|
| CPUs | 16 | ~9 cores steady-state |
| Memory | 8 GiB | ~4 GiB (2 GiB per replica) |
| Throughput | — | ~28 req/s |
| p50 latency | — | ~280ms |
Without MPK, the model loads from the HuggingFace cache. Pre-download it first:
python -c "from gliner2 import GLiNER2; GLiNER2.from_pretrained('fastino/gliguard-LLMGuardrails-300M')"
# Run (model loads from HF cache via the GLIGUARD_MODEL_PATH default)
python -m uvicorn server:app --host 0.0.0.0 --port 8001
Benchmarks live in tf-test/services/cpu-safeguards/.
1 commits
Go
47.6%
Python
39.3%
Dockerfile
13.1%