LLM-as-Judge for Agent Evaluation: Rubric Design and Bias Calibration

    This article explains how to evaluate AI agents from a trajectory perspective, design observable rubrics, detect and calibrate judge bias, enforce structured judge outputs, and integrate evaluation into the development lifecycle. It covers practical trade-offs in scoring formats, gold-set calibration, position-swap tests, output validation, regression gates, and human review.

    1. Why Agent Evaluation Needs a Trajectory View

    Agent quality cannot be judged only by whether the final response reads well. Reliability depends on whether the agent can complete tasks consistently: whether it understands user intent accurately, plans steps reasonably, selects tools and fills in parameters correctly, recovers from errors, stays on goal across multiple turns, and keeps overall cost under control.

    The evaluation target should therefore expand from a single result text to the complete trajectory, including multi-turn dialogue, each tool call, and tool return values. A trajectory can be replayed, quantified, and used to locate problems, so teams can determine whether a failure occurred in understanding, planning, tool invocation, or recovery.

    This type of evaluation has three challenges. First, model outputs are probabilistic. The same input may produce different action sequences; final responses may look similar while intermediate steps are completely different. Second, errors are often hidden in a misunderstanding or parameter deviation in a particular turn. Without unified logs and scoring criteria, teams struggle to reach a consistent judgment. Third, in customer service, sales, assistant, and similar scenarios, success means completing the goal under constraints and satisfying the user. There is no single correct answer, and exact matching cannot measure this kind of quality.

    For these semantic dimensions, rules and regular expressions are often insufficient. LLM-as-Judge is a common supplement. Its role is to cover semantic judgments that are difficult to rule-based checks, not to replace deterministic validation. Whether a tool call succeeded, whether JSON is valid, and whether an amount matches the order should still be checked directly by code.

    2. Rubric Design: Breaking Down “Good” into Observable Criteria

    A rubric is the basis for judging. If the judge model is only asked to “give an overall score,” the score is often dominated by overall impression, making it difficult to explain and reproduce. A good rubric should follow these principles:

    1. Separable dimensions: Each dimension measures only one thing. For example, “intent understanding accuracy” and “tool parameter completeness” should be scored separately.
    2. Observable descriptions: Anchor descriptions should point to behaviors that can be found as evidence in the trajectory, not subjective phrases such as “performs well.”
    3. Clear anchors: Each score level needs a specific description so judges can make consistent decisions between adjacent levels.
    4. Goal alignment: Dimensions should come directly from business goals.

    A recommended approach is to first organize goals into three layers. Task goals answer what the user wants to accomplish. Constraint goals list restrictions such as policy, permissions, latency, cost, and style. Process goals define the key steps that must be followed. These three layers map to outcome, constraint, and process dimensions.

    Below is a simplified rubric example for a refund task:

    Dimension Evaluation question 1 3 5
    Intent recognition Does it correctly identify the refund request? Misunderstands it as another business request Identifies the main intent but misses sub-requests Fully identifies all requests
    Tool parameters Are key parameters such as the order ID correct? Key parameters are wrong Parameters are correct but redundant or missing fields Parameters are complete and consistent with context
    Policy compliance Does it follow refund conditions? Violates explicit rules Rule judgment is basically correct, but explanation is incomplete Rule judgment is correct and sufficiently explained
    Process compliance Does it verify the order before executing the refund? Skips verification Step order has flaws Step order is complete and correct

    Scoring format also needs consideration. Binary judgments (pass or fail) are the most stable but carry less information. Multi-level scales provide richer information but are more prone to boundary ambiguity. Pairwise comparison (which of A and B is better) is reliable for relative quality judgment but cannot produce an absolute score. A common practice is to use multi-level scales with anchor descriptions for key dimensions, and pairwise comparison for version comparisons.

    3. Bias Identification and Calibration: Making Judge Results Hold Up

    LLM judges have several systematic biases. Without identification, scoring results will diverge from true quality. Common biases include:

    • Position bias: In pairwise comparison, the answer placed first or last is more likely to receive a higher score.
    • Length bias: Longer answers are often mistakenly judged as more complete.
    • Self-preference: The judge model gives higher scores to text with a style similar to its own.
    • Tone bias: Confident-sounding, neatly formatted answers are more likely to receive higher evaluations, even when the content is incorrect.

    3.1 Detecting Bias

    The most direct way to detect bias is through controlled experiments.

    First, swap-position testing. Reverse the order of the same pair of answers and judge again. If the two results clearly flip, position bias exists. The flip rate can be used to quantify the problem.

    Second, no-substantive-change testing. Rewrite the same answer by changing only phrasing without changing facts, or add irrelevant pleasantries at the end, and observe whether the score changes. A score change indicates that the judge is sensitive to surface features.

    Third, repeated-stability testing. Judge the same sample multiple times and calculate the variance of scores. Excessive variance indicates instability, requiring reduced randomness or an increased number of judge runs.

    3.2 Basic Calibration Workflow

    The core of calibration is building a human-labeled gold set. The steps are as follows:

    1. Sample representative trajectories from real or simulated data, covering different difficulty levels and failure types.
    2. Have two or more annotators familiar with the business independently score samples according to the rubric. Discuss disputed samples, unify standards, and form annotation guidelines.
    3. Use the judge model to score the gold set and calculate agreement with human annotations. Cohen’s kappa can be used for categorical dimensions, and Spearman correlation can be used for ranking consistency on ordered scores.
    4. For dimensions with high disagreement, revise anchor descriptions in the rubric or adjust the judge prompt, then re-evaluate.

    Common debiasing methods include: randomizing answer order and averaging bidirectional judgments; running multiple independent judgments on the same sample and taking the median; setting a low judge temperature to reduce random fluctuation; and using a different model version or prompt for the judge than for the evaluated model to reduce self-preference.

    The following illustrative code shows how to perform position-swap detection:

    1. def pairwise_judge(judge, task, ans_a, ans_b, rubric):
    2. # Forward judgment: A first
    3. score_ab = judge(task, ans_a, ans_b, rubric)
    4. # Reverse judgment: B first
    5. score_ba = judge(task, ans_b, ans_a, rubric)
    6. # Normalize to "A relative to B"; positive means A is better
    7. pref_ab = score_ab["winner_score"] - score_ab["loser_score"]
    8. pref_ba = score_ba["loser_score"] - score_ba["winner_score"]
    9. consistent = (pref_ab > 0) == (pref_ba > 0)
    10. return {
    11. "preference": (pref_ab + pref_ba) / 2,
    12. "position_consistent": consistent,
    13. }

    In this function, judge is a wrapper for calling the judge model and returns structured results. When position_consistent is false, the sample’s judgment is affected by order and should enter a human review queue rather than being counted directly in statistics.

    4. Structured Output: Parseable, Aggregatable, and Replayable

    Free-text judge comments are difficult to aggregate automatically. Structured output allows scoring results to enter the data pipeline directly and makes replay and auditing easier.

    When designing structured output, follow these conventions:

    • Fixed fields: Each dimension outputs an object containing the dimension name, score, evidence, and reason.
    • Evidence before conclusion: Require the judge to quote specific steps from the trajectory before giving a score, reducing impression-based scoring.
    • Scores within valid ranges: Scores may only take the discrete values defined by the rubric.
    • Record raw output: Keep the original text of each judgment for later troubleshooting.

    An example output structure is shown below:

    1. {
    2. "sample_id": "trace_20261124_0031",
    3. "dimensions": [
    4. {
    5. "name": "Tool parameters",
    6. "evidence": "In step 3, the refund API call used an order ID matching the last four digits provided by the user",
    7. "score": 4,
    8. "reason": "Parameters were complete, but the refund reason field was not recorded"
    9. }
    10. ]
    11. }

    The parser needs to perform strict validation. The following code demonstrates basic validation logic:

    1. import json
    2. VALID_SCORES = {1, 2, 3, 4, 5}
    3. def parse_verdict(raw_text, expected_dims):
    4. try:
    5. data = json.loads(raw_text)
    6. except json.JSONDecodeError:
    7. return None, "invalid_json"
    8. seen = {d.get("name"): d for d in data.get("dimensions", [])}
    9. for dim in expected_dims:
    10. item = seen.get(dim)
    11. if item is None:
    12. return None, f"missing_dimension:{dim}"
    13. if item.get("score") not in VALID_SCORES:
    14. return None, f"invalid_score:{dim}"
    15. if not item.get("evidence"):
    16. return None, f"missing_evidence:{dim}"
    17. return data, "ok"

    When parsing fails, set a limited number of retries, such as at most two. Samples that still fail after retries should have the reason recorded and be routed to human handling, avoiding invalid results contaminating statistics.

    5. Engineering Closed Loop: Integrating Evaluation into Development

    Even high-quality one-off judging needs to operate within a continuously running system to be useful. A relatively mature approach is Evaluation-Driven Development, connecting offline evaluation, canary validation, online monitoring, and automated regression into a closed loop.

    Specific practices include:

    • Version management: Rubrics, judge prompts, gold sets, and model versions should all have version numbers. Any change should be traceable to the corresponding evaluation results.
    • Regression gates: Every time an agent’s prompt, tools, or model are changed, run evaluation on the gold set. Block release when key dimensions fall below thresholds.
    • Layered judging to control cost: First use rule-based checks to filter obviously incorrect trajectories, then use LLM judges for semantic judgments, and finally sample for human review.
    • Monitor score distributions: The mean and variance of online judge scores drift as the business changes. Set alerts to detect anomalies in the judge itself or the evaluated system in time.
    • Periodic recalibration: After business rules and user populations change, revalidate the gold set and human agreement rate.

    LLM judges also make mistakes. Their conclusions should be treated as signals with uncertainty, not as ground truth. For scenarios involving funds, compliance, or safety, judge results should be used as supporting evidence, and key judgments still require human confirmation. Only by combining bias detection, structured validation, and human spot checks can automated evaluation remain trustworthy over long-term operation.