Human evaluation of LLM outputs is the gold standard — but it doesn't scale. When you're generating thousands of responses per day, you need automated quality assessment. LLM-as-a-judge uses a capable language model to evaluate the outputs of another, providing scalable quality scores without human bottlenecks.
You pass the original prompt, the model's response, and an evaluation rubric to a judge model. The judge returns a score, a verdict, or a structured assessment:
judge_prompt = """You are evaluating a customer support response.
Original customer question: {question}
Support response: {response}
Rate the response on these criteria (1-5):
- Accuracy: Does it correctly address the issue?
- Completeness: Does it fully resolve the query?
- Tone: Is it professional and empathetic?
Return ONLY valid JSON:
{{"accuracy": N, "completeness": N, "tone": N, "pass": true/false, "reason": "..."}}"""
result = await judge_client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": judge_prompt.format(
question=original_question,
response=model_response
)}],
response_format={"type": "json_object"}
)
Two main evaluation modes:
Pairwise comparison correlates better with human preferences. Use it when you're comparing models or prompt variants; use absolute scoring for production monitoring.
response_format: json_object to get structured, parseable scoresRunning a GPT-4o judge on every production response is expensive. A 500-token prompt + 200-token judgment = 700 tokens × $0.005/1K = $0.0035 per eval. At 100K evals/day that's $350/day just for evaluation. Strategies to reduce this:
Tokoscope monitors token usage across your primary model and judge model separately, so you can see what your eval pipeline actually costs. Free to start.
Get started free →