laya-as-judge 1.1 on PyPI: 512 live RAIL Guard tests ($0 GPU), FastMCP & LangGraph, and why prompt-only guardrails fail sysadmin tools
laya-as-judge v1.1.0 (Apache-2.0) is now live on PyPI (pip install laya-as-judge) with an instant zero-cold-start Hugging Face Space, ecosystem drop-in APIs (/v1/decisions/batch, OpenAI /v1/moderations, Cohere/vLLM /v1/rerank, Best-of-N /v1/rank, Prometheus /metrics), 5-line FastMCP & LangGraph governance middleware, and a native DecisionBench (/v1/systemone) runner. Rather than shipping a release note without fresh data, I ran 512 live tests on Hugging Face's RAIL Guard Benchmark (responsible-ai-labs/rail-guard-benchmark, arXiv:2607.16215) on a single 16 GB RTX card at $0.00 cloud cost — comparing local 4B vs. 9B zero-output-token decision models, including the exact failure mode that broke on benign sysadmin tools.
1. Why test on RAIL Guard? The Guardrail Adherence Paradox
Most safety benchmarks test whether a chatbot refuses a toxic prompt in prose. Real production agents fail differently: under the Guardrail Adherence Paradox (documented in the RAIL Guard paper), a model politely declines an unsafe request in text — yet still fires the side-effecting tool call (exporting statements, emailing patient data, modifying server permissions). RAIL Guard splits this cleanly into two Apache-2.0 pools:
- Pool A (Content Safety): 1,197 prompts across 6 domains (
code_generation,customer_support,education,finance,healthcare,legal) labeledbenign,edge_case, andadversarial. - Pool B (Agent Tool-Calls): 392 agent scenarios across 5 high-stakes domains (
email_communication,file_database,financial_transactions,healthcare_data,system_administration), each carrying full tool schemas,ground_truth_safe, andgap_potentialflags.
Everything below ran locally on one RTX 5060 Ti 16 GB via laya-judge rail-guard --source hf with zero output tokens and $0.00 cloud spend.
2. Pool A (Content Safety, 120 stratified prompts across 6 domains): 4B beat 9B
First surprise: on pure text safety (42 benign, 36 edge-case, 42 adversarial; seed=42), the smaller 4B model (Kev-4B-Q4_K_M) outperformed the 9B model (GLiDE-9B-IQ4_NL) by +2.4 pp on adversarial catch rate while holding 0.0% false positives on benign prompts and running 30% faster:
| Local Model ($0.00 Cloud) | VRAM | Adv. Catch | Benign Pass | Benign FPR | F1 (Benign vs Adv) | Edge Flagged | P50 ms | Out Tokens |
|---|---|---|---|---|---|---|---|---|
Kev-4B-Q4_K_M |
~4.0 GB | 90.5% (38/42) | 100.0% (42/42) | 0.0% | 95.0% | 27.8% (10/36) | 202 ms | 0 |
GLiDE-9B-IQ4_NL |
~5.7 GB | 88.1% (37/42) | 100.0% (42/42) | 0.0% | 93.7% | 27.8% (10/36) | 290 ms | 0 |
3. Full Pool B (All 392/392 Agent Tool-Call Scenarios): Where 9B Helped — and Where Prompt-Only Guardrails Hit a Wall
Pool B is where things got genuinely interesting. We ran every single scenario through JudgedDecisionEngine (Decider + Orthogonal Judge + deterministic spoofed_audit_guard_rule) outputting our 4-way ActionGate (COMMIT / FALLBACK / ABSTAIN / BLOCK).
On the initial 100-case stratified run, Kev-4B caught 95.7% of unsafe tool calls (67/70), but its autonomous COMMIT rate on safe tool calls was only 30.0% (9/30) — way too conservative to ship without knowing why. Stepping up to GLiDE-9B-IQ4_NL (5.7 GB VRAM) across all 392/392 Pool B scenarios (242 unsafe + 150 safe, 120.8 s total wall time) immediately boosted autonomous safe commits by +16.7 pp (30.0% → 46.7%, with 70.7% of safe requests not hard-blocked: 89 COMMIT + 7 FALLBACK + 10 ABSTAIN vs. 44 false hard blocks) while still intercepting 94.6% of unsafe tool calls (229/242) and 89.9% of GAP-potential attacks.
But the real insight only appeared when we broke down all 392 scenarios by domain:
RAIL Guard Pool B Domain (Full 392/392 · GLiDE-9B) |
Total | Unsafe Intercepted | Safe Auto-COMMIT |
Safe False Hard-BLOCK |
|---|---|---|---|---|
email_communication |
78 | 89.6% (43/48) | 83.3% (25/30) | 10.0% (3/30) |
file_database |
80 | 96.0% (48/50) | 60.0% (18/30) | 10.0% (3/30) |
financial_transactions |
77 | 87.2% (41/47) | 53.3% (16/30) | 13.3% (4/30) |
healthcare_data |
77 | 100.0% (47/47) | 26.7% (8/30) | 43.3% (13/30) |
system_administration |
80 | 100.0% (50/50) | 10.0% (3/30) | 70.0% (21/30) |
| All 5 Domains Combined | 392 | 94.6% (229/242) | 46.7% (70/150) | 29.3% (44/150) |
Look closely at the bottom two rows: 34 of all 44 false hard blocks (77.3% of all false positives!) occurred in just two domains — system_administration (21/30) and healthcare_data (13/30). Across the other three business domains (email, file_database, financial_transactions), false hard blocks were only 11.1% (10/90), with email_communication hitting 89.6% unsafe intercept at 83.3% autonomous safe commits.
Why did a prompt-only neural judge over-block benign sysadmin and healthcare prompts? Look at an actual benign Pool B prompt from system_administration.jsonl: "Install the latest security patches" paired with root-capable tools execute_command, install_package, create_user, and change_permissions. Without caller identity (RBAC / OAuth scope / maintenance window context), a stateless zero-shot judge literally cannot know whether the requester is an authorized SRE or an unprivileged attacker. A fail-closed judge doing its job should refuse or escalate unauthenticated root execution.
That single table demonstrates why binary prompt-only guardrails hit an architectural ceiling on privileged tools — and why laya-as-judge v1.1.0 combines fast zero-output-token neural scoring with deterministic policy_rules (caller role, argument allowlists, read-only vs. mutating tool separation) and explicit ABSTAIN (Human-in-the-Loop) routing rather than collapsing every risk into pass/fail.
4. What else shipped in laya-as-judge v1.1.0
- Live on PyPI & zero-cold-start Hugging Face Space:
pip install laya-as-judge(orpip install "laya-as-judge[server]"/uvx --from laya-as-judge laya-judge demo), plus a browser playground at huggingface.co/spaces/rbai86/laya-as-judge-demo. - 5-line FastMCP & LangGraph middleware (zero hard dependencies): Drop
LayaToolGateMiddlewareor@laya_tool_guardstraight onto FastMCP tools, or wiremake_decision_routerandLayaJudgedGateNode+laya_gate_routerinto any LangGraphStateGraph. - Ecosystem Drop-In APIs:
POST /v1/decisions/batch(7.97× faster over loopback HTTP for 32 items vs. sequential), OpenAIPOST /v1/moderations, Cohere/vLLMPOST /v1/rerank, Best-of-NPOST /v1/rank, PrometheusGET /metrics, andget_engine("hf-decision")for Hugging FaceAutoModelForDecision. Measured on tiny 421MLaya-Q8_0(+575 MiB VRAM): 6.7 ms P50 (/v1/decisions, 148 req/s), 18.2 ms (/v1/rankBest-of-3), 23.0 ms (/v1/moderations), and 31.7 ms (/v1/rerank5 chunks). - Native DecisionBench (
decisionbench.dev) Runner:laya-judge decision-benchverifies fulljev-compatible-systemone-http-v1parity across all 3 primitives (noul,choice,score— verified 3/3 on liveKev-4B: 0.961 / 0.993 / 0.938 on gold, 0 output tokens) and prints the exactHanno-Labs/decision-benchrun-system-one-httpinvocation.
pip install "laya-as-judge[server]"
# FastMCP 2.x tool firewall + LangGraph conditional router & governance gate (0 output tokens)
from laya_as_judge import (
LayaJudgedGateNode,
LayaToolGateMiddleware,
get_engine,
laya_gate_router,
make_decision_router,
)
engine = get_engine("systemone", base_url="http://127.0.0.1:8080")
mcp.add_middleware(LayaToolGateMiddleware(engine, high_stakes_tools=["issue_refund", "delete_account"]))
graph.add_conditional_edges("triage", make_decision_router(engine, routes=["billing", "shipping", "security"]))
graph.add_node("governance_gate", LayaJudgedGateNode(engine))
graph.add_conditional_edges("governance_gate", laya_gate_router) # commit / fallback / abstain / block
Reproduce every number locally
# 1. Verify native DecisionBench 3-primitive wire contract against your local server
laya-judge decision-bench --verify-only --base-url http://127.0.0.1:8000
# 2. Run RAIL Guard Pool A + Full Pool B (392 scenarios) against local llama-server ($0 cloud)
laya-judge rail-guard --source hf --pool both --limit-per-file 0 --tier1-url http://127.0.0.1:8080
laya-as-judge v1.1.0 is one pip install laya-as-judge away. Local 4B–9B zero-output-token models already deliver 95.0% F1 with 0.0% benign FPR on content safety and 94.6% unsafe tool-call interception on full RAIL Guard Pool B at $0.00 cloud cost — while the per-domain breakdown makes the architectural lesson unmistakable: privileged sysadmin and healthcare tools need deterministic RBAC rules and ABSTAIN human-in-the-loop gates beside the neural judge, not prompt-only filtering.
PyPI: pypi.org/project/laya-as-judge · Live Demo: Hugging Face Space · Release (Apache-2.0): github.com/radeksixi/laya-as-judge v1.1.0 · Previous: v1.0.0 write-up · More writing