Skip to content

Judge guardrails: what a check costs

Last updated: 2026-11-26T03:21:52-03:00 (UTC-3)

How much a judge guardrail adds to a request, apart from the judge model’s own time. A judge guardrail is the one evaluation feature on the request path, by design: it adds one model call per checked request.

  • The gateway adds about 5 ms at the median to a guarded request: resolving the evaluator (cached for 15 seconds), the narrowed internal call to the judge alias with its own usage row, valuation and spans, and reading the verdict. The p95 adds about 6 to 11 ms.
  • The judge model’s latency comes on top. With a small hosted model expect a few hundred milliseconds; set timeout to what your traffic can wait for, and on_error for what happens past it.
  • The result is written off the request path, so the result engine (database or analytics store) does not change the request’s figure; the two engines measure the same within noise.
  • The cost of the judge call is the judge model’s tokens at its price: keep max_tokens low (64 by default) and the checked text short (max_input_chars, 8,000 by default).

A probe in the gateway’s own test suite (internal/gateway/judge_guardrail_probe_test.go, run only on request with GATEWAY_TEST_JUDGE_GUARDRAIL_PROBE=<path>) sends the same chat request through the whole gateway handler, with PostgreSQL 16 (and ClickHouse 25.12 for the analytics-store rows), durable usage, valuation, charge lines and the span store on, first without a guardrail and then with a judge guardrail at input. A local stand-in answers both the provider and the judge at once, so the difference between the rows is the gateway’s own work. Allocations and bytes are the whole process’s per request, test harness included, so compare the rows with each other rather than read them alone.

  • One Apple M4 Pro machine with other work running on it, so the p95 includes scheduling noise; the p50 is the steadier figure.

The recorded run is in judge-guardrails.json.

Result engine Request p50 (ms) p95 (ms) Added at p50 (ms) Allocations per request KiB per request Judge calls
Database (PostgreSQL) No guardrail 7.6 10.2 +0.0 13,040 1,122 0
Database (PostgreSQL) Judge guardrail at input 12.4 16.6 +4.9 15,112 1,281 300
Analytics store (ClickHouse) No guardrail 7.2 10.0 +0.0 13,438 1,144 0
Analytics store (ClickHouse) Judge guardrail at input 13.1 20.9 +5.9 16,336 1,372 300

Each row is 300 requests after 30 warm-up ones, recorded 2026-11-26 on darwin/arm64. Provider calls: one per request in every row; judge calls: one per guarded request.

The added time is mostly the judge’s own request through the gateway: its admission, its usage row written before the call returns (so the result can carry the judge’s exact cost) and its spans. A guardrail in monitor mode costs the same as one in block mode; only what happens to a failing request differs.

m7gtw[email protected]