5.1 KiB
Evaluation Failure Patterns & Fixes
Common failure modes observed in GenAI agent evaluations, mapped to their root causes and concrete fixes.
Metric-Specific Failures
Low hallucination_v1 or grounding_v1 Score
Symptom: Agent generates plausible-sounding but factually incorrect information, or doesn't use the provided context.
Root causes:
- System prompt lacks explicit grounding instructions
- Retrieved context not passed into the prompt
- Agent ignores context in favor of parametric knowledge
Fixes:
- Add to system prompt: "Base ALL answers strictly on the provided context. If the context doesn't contain the answer, say 'I don't have that information.'"
- Verify context is actually injected into the prompt (check tool responses)
- Add
temperature=0or lower temperature to reduce creative generation
Low general_quality_v1 or text_quality_v1
Symptom: Agent responses are poorly structured, unclear, or unhelpful.
Root causes:
- System prompt too vague
- Agent over-explains or under-explains
- Missing output format instructions
Fixes:
- Add explicit format instructions: "Respond concisely in 2-3 sentences."
- Add few-shot examples in the system prompt
- Review rubric verdicts for specific quality dimensions that scored low
Low tool_use_quality_v1 or tool_call_valid
Symptom: Agent calls the wrong tool, uses wrong parameters, or doesn't call tools when it should.
Root causes:
- Tool descriptions are ambiguous
- Multiple tools have overlapping functionality
- Function declaration parameter schemas are incomplete
Fixes:
- Make tool
descriptionfields precise and mutually exclusive - Add parameter descriptions and constraints to
FunctionDeclaration - Add to system prompt: "Always use {tool_name} when the user asks about {specific_topic}."
- Check
tool_name_matchandtool_parameter_kv_matchfor granular diagnosis
Low multi_turn_trajectory_quality_v1
Symptom: Agent takes suboptimal paths through a conversation — unnecessary tool calls, redundant questions, or wrong delegation order.
Root causes:
- Router agent lacks clear delegation rules
- Agent retries failed operations without adaptation
- Missing escalation logic
Fixes:
- Add explicit routing rules: "Route to {agent} when {condition}."
- Add retry limits: "If {tool} fails twice, inform the user and suggest alternatives."
- Review the trajectory events in
agent_datato identify the specific turn where the agent deviated
Low multi_turn_task_success_v1
Symptom: Agent engages in conversation but doesn't complete the user's actual goal.
Root causes:
- Agent gets sidetracked by follow-up questions
- Missing confirmation/completion step
- Agent doesn't track task state across turns
Fixes:
- Add to system prompt: "Always confirm task completion with the user before ending the conversation."
- Implement explicit task tracking in agent logic
- Verify
max_turnin user simulator is sufficient for the task complexity
Low safety_v1
Symptom: Agent generates unsafe content or complies with harmful requests.
Root causes:
- System prompt lacks safety constraints
- Agent follows user instructions too literally
- Missing refusal logic for out-of-scope requests
Fixes:
- Add safety guardrails: "Never provide medical/legal/financial advice. Redirect to appropriate professionals."
- Add refusal patterns: "If the user asks for {harmful_category}, politely decline."
- Use
safety_v1alongside domain-specificLLMMetricsafety checks
Structural Failures
is_infra_error: true
Symptom: Eval case fails with infrastructure error, not a quality issue.
Root causes:
- API quota exceeded
- Network timeout
- Model endpoint temporarily unavailable
Fix: Re-run the evaluation. If persistent, check quota and endpoint health.
Timeout
Symptom: Evaluation times out before completing.
Root causes:
- Dataset too large for a single API call
- Complex custom metric code takes too long
- Judge model sampling count too high
Fixes:
- Reduce dataset size or batch into smaller chunks
- Optimize custom metric code (avoid network calls in
evaluate()) - Reduce
judge_model_sampling_count(default 1, max 32)
KeyError in Custom Metric
Symptom: Custom function crashes with missing field.
Root cause: Metric function expects a field not present in the eval case.
Fix: Check available fields in the instance dict. Common fields:
prompt, response, reference, agent_data. Always use .get() with
defaults.
Analysis Workflow
When eval results show failures:
- Start with
summary_metrics— identify which metrics scored lowest - Drill into
eval_case_results— find specific failing cases - Read
rubric_verdicts— understand why the judge scored low - Cross-reference with
agent_data— find the exact turn/event that caused the failure - Identify the pattern — is it a prompt issue, tool issue, or data issue?
- Apply the targeted fix — from the table above
- Re-run and compare — verify the fix improved the target metric