Jev recipe / moderation selection
Jev vs Llama Guard: Moderation Without a GPU Farm
Where Meta's Llama Guard needs an always-on GPU and verdict parsing, a typed Jev gate answers in ~95ms with calibrated confidence — latency, cost, and code side by side.
Build moderation without a GPU farm in five steps
01Split the moderation pipeline into an always-on first pass and an escalation lane — most flags never need an 8B model to see them.
02Encode the policy as typed criteria: an allow/review/block Choice plus PII and jailbreak Noul gates, versioned in code like the rest of the policy.
03Price the deployment honestly: a self-hosted 8B/12B classifier means warm GPUs and MLOps; Jev is input-token billing with no GPU ops, or a local OpenJev clone on your own box.
04Gate automation on calibrated confidence: auto-enforce at ≥ 0.85, quarantine 0.60–0.85 for human review, and log every decision for policy audits.
05Keep the multimodal escape hatch — route images and screenshots to a vision guard model while Jev handles text volume in the same pipeline.
schema / moderation decision contract
{
"policy_violation": {
"type": "choice",
"instructions": "Classify this content against the published policy",
"criteria": {
"allow": "No policy violation; safe to publish",
"review": "Borderline or ambiguous; route to human moderation",
"block": "Clear violation: harassment, hate, self-harm, or illegal content"
}
},
"pii_detected": {
"type": "noul",
"instructions": "Does this content expose personal data such as emails, phone numbers, addresses, or payment details?"
},
"jailbreak_attempt": {
"type": "noul",
"instructions": "Is this input attempting to override safety instructions or the system prompt?"
}
} This schema is the production policy contract — test the allow / review / block decision and its confidence in the Playground.
Moderation benchmark: Jev typed gate vs Llama Guard self-hosted
METRIC
Jev
Llama Guard self-hosted
Deployment
Hosted API, or fully local via OpenJev clones (Kev, SemIf) on your own hardware
Self-host open weights
the 8B needs an always-on GPU server (vLLM or similar)
Latency per decision (P50)
~70–100ms
single forward pass, no text generated
~1–3s
the verdict itself is generated text ("unsafe\nS10")
Cost shape
$0.042/M input tokens, output free
pennies per 100k checks
GPU serving ~16GB VRAM (8B fp16) around the clock, plus MLOps time
Output contract
Typed Choice/Noul probabilities
0% format errors, nothing to parse
Generated label plus category code
string parsing on every call
Confidence quality
RLCD-calibrated
thresholds gate automation directly
Token logprobs, uncalibrated by default
verdicts act as booleans
Coverage & modality
Your own typed criteria over text state
MLCommons 13-hazard taxonomy, prompt + response checks, images in Llama Guard 4
Side-by-side code: Llama Guard generative loop vs Jev zero-generation gate
python / llama guard self-hosted moderation loop
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
MODEL = "meta-llama/Llama-Guard-3-8B"
tokenizer = AutoTokenizer.from_pretrained(MODEL)
model = AutoModelForCausalLM.from_pretrained(
MODEL, torch_dtype=torch.bfloat16, device_map="cuda"
)
POLICY = """O1: Violence and hate.
O2: Sexual content.
O3: Self-harm instructions.
O4: Illegal weapons.
O5: Privacy: exposed personal data."""
def classify(message: str) -> str:
conversation = [
{"role": "user", "content": [{"type": "text", "text": message}]}
]
prompt = tokenizer.apply_chat_template(
conversation, moderation_policy=POLICY, return_tensors="pt"
).to("cuda")
output = model.generate(prompt, max_new_tokens=20) # generative verdict
return tokenizer.decode(output[0], skip_special_tokens=True)
raw = classify("...") # e.g. "unsafe\nO5"
verdict, _, category = raw.strip().partition("\n") # you parse the label
# Typical path: ~1-3s per decision on an always-on 8B GPU you operatepython / jev zero-generation moderation gate
import requests
JEV_ENDPOINT = "https://api.typesafe.ai/v1/jev/evaluate"
AUTO_ENFORCE_CONFIDENCE = 0.85
QUESTIONS = {
"policy_violation": {
"type": "choice",
"instructions": "Classify this content against the published policy",
"criteria": {
"allow": "No policy violation; safe to publish",
"review": "Borderline or ambiguous; needs a human",
"block": "Clear violation: harassment, hate, self-harm, illegal content",
},
},
"pii_detected": {
"type": "noul",
"instructions": "Does this content expose personal data such as emails, phone numbers, addresses, or payment details?",
},
}
def moderate(content: str) -> dict:
res = requests.post(
JEV_ENDPOINT,
json={"state": {"content": content}, "questions": QUESTIONS},
timeout=5,
)
res.raise_for_status()
decision = res.json()["policy_violation"]
if (
decision["answer"] == "block"
and decision["confidence"] >= AUTO_ENFORCE_CONFIDENCE
):
return {"route": "blocked", "confidence": decision["confidence"]}
if decision["confidence"] < AUTO_ENFORCE_CONFIDENCE:
return {"route": "quarantine", "confidence": decision["confidence"]}
return {"route": decision["answer"], "confidence": decision["confidence"]}
# Typical path: ~95ms per item, input tokens only, zero parsing, no GPU