This playbook is for AI reliability engineers, quality engineers, and platform teams who have access to step-level trace data and need to produce a linked chain of evidence connecting an eval failure back to its root cause. The prompt assumes you already have the failed eval result, the rubric definition, and the full trace log. It does not replace initial triage or aggregate trend analysis. Use it when you need a precise, auditable mapping from a specific rubric violation to the retrieval step, tool call, context truncation, or generation event that triggered it.
Prompt
Quality Rubric Violation Trace-to-Eval Mapping Prompt

When to Use This Prompt
Use this prompt when a production response fails a quality rubric evaluation and you need to identify the exact trace event that caused the violation.
Before using this prompt, confirm that you have isolated a single eval failure with a clear rubric dimension that was violated. The trace must include step-level attribution—such as retrieval calls, tool invocations, context window snapshots, and generation events—with timestamps or sequence IDs. If your observability tooling only captures final outputs without intermediate steps, this prompt will not produce reliable results. The prompt works best when the eval rubric is structured with explicit pass/fail criteria per dimension, not a single aggregate score. For example, a rubric with dimensions like citation_accuracy, completeness, and format_compliance allows the prompt to trace each violation independently.
Do not use this prompt for aggregate trend analysis, real-time alerting, or initial triage of an incident. It is designed for deep-dive investigation of a single failure, not for scanning hundreds of traces. If you need to correlate multiple failures across sessions, start with the sibling playbook for incident trace correlation. If you suspect the eval itself is flawed, use the LLM Judge Score Inconsistency Investigation prompt first. After running this prompt, you should have a clear root-cause statement and a specific trace event ID that you can hand off to the team responsible for the failing component—whether that is retrieval, tool configuration, context assembly, or model behavior.
Use Case Fit
Where the Quality Rubric Violation Trace-to-Eval Mapping Prompt delivers value and where it creates noise or risk.
Good Fit: Structured Trace Data Available
Use when: you have step-level trace data with attribution (retrieval, tool calls, context window snapshots) and a specific eval rubric violation to investigate. Guardrail: ensure trace data includes timestamps, step IDs, and input/output pairs before running the prompt.
Bad Fit: Black-Box Model Outputs
Avoid when: you only have the final model response and eval score without intermediate trace events. Guardrail: the prompt requires trace granularity; without it, the mapping becomes speculative. Invest in trace instrumentation first.
Required Input: Eval Rubric with Dimension-Level Scores
Use when: your eval rubric breaks down into specific dimensions (e.g., faithfulness, completeness, citation accuracy) with per-dimension scores. Guardrail: the prompt cannot map violations to traces if the eval only provides a single aggregate score.
Operational Risk: Trace Volume Overwhelm
Risk: running this prompt on every eval failure in high-volume production systems creates excessive cost and latency. Guardrail: trigger the prompt only for high-severity eval failures or sampled regressions, not as a real-time step in every request.
Bad Fit: Ambiguous or Poorly Defined Rubrics
Avoid when: the eval rubric uses vague criteria like 'quality' or 'helpfulness' without operational definitions. Guardrail: the prompt needs concrete, testable rubric dimensions to produce a traceable evidence chain. Refine the rubric before tracing.
Operational Risk: Sensitive Data in Traces
Risk: traces may contain PII, proprietary code, or regulated data that should not be sent to external model providers. Guardrail: redact sensitive fields from trace data before passing to the prompt, or run the analysis with a local model in a private environment.
Copy-Ready Prompt Template
A reusable prompt template for mapping a specific quality rubric violation back to the trace event that caused it, producing a linked chain of evidence.
This prompt template is the core diagnostic tool for closing the loop between a production eval failure and its root cause. It is designed to be pasted into your investigation notebook or wired into an automated diagnosis pipeline. The template forces a structured, step-by-step analysis that links a single rubric violation to a specific trace event—such as a bad retrieval step, a truncated context window, or an incorrect tool call—and demands evidence for every claim. This prevents the common failure mode of hand-waving root-cause analysis and ensures the output is a verifiable artifact that can be shared with the engineer responsible for the fix.
textYou are a production AI diagnostician. Your task is to map a specific quality rubric violation to the precise trace event that caused it. You must produce a linked chain of evidence, not a summary of suspicions. ## INPUT DATA ### The Quality Rubric Violation - **Rubric Rule:** [RUBRIC_RULE_DESCRIPTION] - **Failed Eval Dimension:** [EVAL_DIMENSION_NAME] - **Eval Score:** [EVAL_SCORE] - **Eval Justification:** [EVAL_JUSTIFICATION] ### The Model's Final Output
[FINAL_OUTPUT]
code### The Production Trace ```json [TRACE_JSON]
CONSTRAINTS
- [CONSTRAINTS]
OUTPUT SCHEMA
You must output a single JSON object with the following structure:
json{ "violation_summary": "A one-sentence restatement of the violation.", "root_cause_event": { "trace_step_id": "The ID of the trace step that is the primary cause.", "event_type": "The type of event (e.g., retrieval, tool_call, context_truncation, llm_generation).", "event_description": "A concise description of what happened at this step." }, "causal_chain": [ { "step_order": 1, "trace_step_id": "The first step in the chain of causation.", "what_happened": "What occurred at this step.", "how_it_contributed": "How this step contributed to the final violation.", "evidence": "Quote the relevant part of the trace or output." } ], "severity_assessment": "critical|major|minor", "recommended_action": "A specific, actionable recommendation for the team that owns the failing component.", "confidence": 0.0 }
INSTRUCTIONS
- Parse the trace JSON to understand the sequence of events: retrievals, tool calls, context assembly, and final generation.
- Identify the specific requirement in the rubric rule that was violated.
- Trace backward from the violation in the final output, through each preceding trace step, to find the root cause event.
- Construct a causal chain where each link is supported by direct evidence quoted from the trace or output.
- If multiple factors contributed, identify the primary root cause and note contributing factors in the causal chain.
- If the trace evidence is insufficient to establish a definitive root cause, set confidence low and state what additional data is needed.
To adapt this template, replace the square-bracket placeholders with data from your production systems. The [TRACE_JSON] placeholder expects a structured trace object that includes step-level attribution—at minimum, a sequence of events with unique IDs, types, and payloads. If your observability platform captures traces in a different format, pre-process them into a normalized JSON structure before insertion. The [CONSTRAINTS] placeholder is for adding domain-specific rules, such as ignoring certain known benign anomalies or prioritizing specific failure categories. For high-risk domains like healthcare or finance, always route the output for human review before taking action on the recommended fix.
After pasting the prompt, run it against a model with strong reasoning capabilities and a large context window, as the trace data can be verbose. Validate the output JSON against the schema before ingesting it into your incident management system. For automated pipelines, wrap this prompt in a retry loop with a validator that checks for the presence of all required fields and a confidence score above your threshold. Log every invocation, including the input trace ID, the output causal chain, and the reviewer's decision, to build an audit trail for future incident postmortems.
Prompt Variables
Required inputs for the Quality Rubric Violation Trace-to-Eval Mapping Prompt. Each variable must be populated from production trace data and eval results before the prompt can produce a reliable evidence chain.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[RUBRIC_VIOLATION] | The specific quality rubric criterion that was violated, including its pass/fail threshold | factual-accuracy: score < 0.7 | Must match an existing eval rubric field name. Reject if rubric name not found in eval config. |
[EVAL_SCORE] | The numeric or categorical score assigned by the evaluator for the violated criterion | 0.42 | Must be a valid score within the rubric's defined range. Reject null or out-of-range values. |
[TRACE_ID] | Unique identifier for the production trace containing the full request lifecycle | trace_4f8a2b1c_2025-03-15 | Must resolve to a complete trace with step-level attribution. Reject if trace is truncated or missing tool-call segments. |
[TRACE_STEPS] | Ordered list of trace events with timestamps, step types, inputs, outputs, and metadata | JSON array of step objects | Must include retrieval steps, tool calls, context assembly, and generation steps. Reject if fewer than 3 steps or missing retrieval/generation boundaries. |
[MODEL_OUTPUT] | The final model response that was evaluated and found to violate the rubric | Full response text or structured output | Must be the exact output that was scored. Reject if output has been post-processed or truncated before eval. |
[RETRIEVED_CONTEXT] | All documents, passages, or evidence chunks inserted into the context window for this request | Array of source objects with content and metadata | Must include relevance scores and source identifiers. Reject if context window contents are not captured in trace. |
[TOOL_CALL_LOG] | Complete log of function calls, arguments, responses, and errors during the trace | JSON array of tool interactions | Must include call timestamps, argument payloads, and return values. Null allowed if no tools were invoked in this trace. |
[CONTEXT_WINDOW_SIZE] | Total token capacity and actual token consumption for the request | {"capacity": 128000, "used": 124500, "truncated": true} | Must include truncation flag. Reject if token counts are missing or estimated rather than measured from trace. |
Implementation Harness Notes
How to wire the Quality Rubric Violation Trace-to-Eval Mapping Prompt into an application or investigation workflow.
This prompt is designed for interactive investigation, not for a real-time production code path. The typical harness is a debugging notebook, an internal observability dashboard, or a Slack bot that on-call engineers invoke during an incident. The prompt expects structured trace data with step-level attribution and a specific eval rubric violation as input. Before wiring it into any tool, confirm that your trace storage can return the full event sequence for a single session, including retrieval steps, tool calls, context window contents, and the final model output. Without step-level attribution, the prompt cannot produce a linked chain of evidence.
When building the harness, validate the input trace payload against a schema before calling the model. At minimum, check that the trace contains a session_id, an array of events with step_type, timestamp, input, and output fields, and a violation object with rubric_id, rubric_description, and failed_output. Reject malformed traces with a clear error message rather than sending incomplete data to the model. For model selection, use a model with strong reasoning capabilities and a context window large enough to hold the full trace. If the trace exceeds the context window, implement a pre-processing step that filters events to those most relevant to the violated rubric dimension—for example, if the rubric concerns citation accuracy, retain retrieval, ranking, and generation steps while summarizing unrelated tool calls. Log every invocation with the session_id, rubric_id, the model's verdict, and the evidence chain for auditability. In regulated domains, require a human reviewer to confirm the model's finding before closing the investigation.
The most common failure mode in production is trace incompleteness. If your observability pipeline samples traces or drops intermediate steps, the prompt will produce a weak or incorrect evidence chain. Before relying on this prompt for incident response, run a dry-run audit across 50 recent eval failures to measure what percentage of traces contain sufficient step-level detail. If the answer is below 80%, invest in trace completeness before investing in investigation automation. Also avoid using this prompt as a substitute for eval rubric refinement—if the same rubric violation repeatedly traces back to an acceptable model behavior, the rubric itself may need adjustment rather than deeper investigation.
Expected Output Contract
Fields, types, and validation rules for the trace-to-eval mapping output. Use this contract to parse, validate, and store the generated evidence chain before surfacing it in a review UI or feeding it into an automated remediation pipeline.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
violation_id | string | Must match a violation ID from the input eval report. Reject if not present in [EVAL_REPORT]. | |
rubric_criterion | string | Must exactly match a criterion name in [QUALITY_RUBRIC]. Case-sensitive string match required. | |
trace_event_id | string | Must be a valid event ID present in [TRACE_DATA]. Parse trace and confirm event exists before accepting. | |
event_type | enum: retrieval_call | tool_call | context_truncation | llm_generation | routing_decision | user_input | null | Must be one of the enumerated values. Reject unknown event types. Use null only if trace_event_id is null. | |
evidence_excerpt | string | Must be a verbatim substring from the trace event payload. Validate by checking substring presence in [TRACE_DATA] at the specified event. Reject paraphrased excerpts. | |
causal_chain | array of {step: integer, event_id: string, description: string} | Array must contain at least 1 step. Each step.event_id must exist in [TRACE_DATA]. Steps must be ordered by step ascending. Reject chains with missing or out-of-order steps. | |
severity | enum: critical | major | minor | Must be one of the enumerated values. If severity in evidence contradicts rubric severity, flag for human review. | |
confidence | float between 0.0 and 1.0 | Must be a number between 0.0 and 1.0 inclusive. If confidence < 0.7, require human review before accepting the mapping as actionable. |
Common Failure Modes
When mapping rubric violations to trace events, these failure modes surface first. Each card pairs a common breakage with a concrete guardrail.
Missing Trace Attribution
What to watch: The prompt identifies a rubric violation but cannot link it to a specific trace step because the trace lacks step-level identifiers, timestamps, or event correlation. The output becomes a vague summary instead of a linked evidence chain. Guardrail: Validate that trace data includes step_id, timestamp, and event_type fields before running the prompt. Reject traces that lack step-level attribution and request instrumentation updates.
Spurious Correlation with Irrelevant Steps
What to watch: The prompt incorrectly attributes a rubric violation to a trace step that is temporally close but causally unrelated, such as blaming a retrieval step for a hallucination that originated in generation. Guardrail: Require the prompt to state a causal rationale for each attribution, not just temporal adjacency. Add a validation check that flags attributions where the linked step's output does not contain the violating content.
Context Window Truncation Blind Spot
What to watch: Evidence needed to explain the violation was truncated from the context window, but the trace does not record what was dropped. The prompt either misses the root cause or fabricates an explanation from visible steps. Guardrail: Require traces to log context_window_usage and truncated_document_ids. If truncation is detected, the prompt must flag it as a possible root cause rather than forcing an attribution to visible steps.
Eval Rubric Misalignment
What to watch: The prompt maps a violation to a trace step correctly, but the eval rubric itself is ambiguous, contradictory, or misaligned with the product requirement. The resulting analysis fixes the wrong problem. Guardrail: Include a pre-check step that validates the rubric against the trace context. If the rubric dimension is unclear, flag it for human review before proceeding with trace-to-eval mapping.
Multi-Step Propagation Oversimplification
What to watch: A violation caused by a chain of trace events is attributed to only the final step, missing the upstream trigger. For example, a bad retrieval query caused poor context, which caused a hallucination, but only the generation step is flagged. Guardrail: Require the prompt to traverse the trace backward from the violation point and identify the earliest step where corrective action would have prevented the failure. Output a propagation chain, not a single blame point.
Tool-Call Argument Corruption
What to watch: The trace shows a tool was called, but the arguments were malformed, truncated, or contained hallucinated parameters. The prompt attributes the failure to the tool's response rather than the malformed call itself. Guardrail: Add a validation step that checks tool-call arguments against the expected schema before attributing downstream failures. Flag argument mismatches as the primary root cause when detected.
Evaluation Rubric
Use this rubric to test whether the trace-to-eval mapping prompt correctly links a quality violation to its root-cause trace event. Each criterion checks a specific dimension of the output's accuracy, completeness, and actionability.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Violation-to-Event Linkage | Output identifies exactly one primary trace event as the root cause, with a step ID and timestamp. | Output lists multiple unranked events, blames the final generation step without evidence, or fails to cite a specific step ID. | Parse output for a single root-cause event ID. Validate the ID exists in the input trace. Check that a causal chain is described, not just correlation. |
Evidence Chain Completeness | Output provides a continuous chain of evidence from the rubric violation back to the root-cause event, with no logical gaps. | Output skips intermediate steps, asserts causation without showing the connecting events, or omits the retrieval/context state at the time of failure. | Manually trace the described chain against the input trace data. Confirm each hop in the chain references a logged event. Flag any assertion not backed by a trace event. |
Rubric Dimension Attribution | Output correctly maps the violation to the specific eval rubric dimension that failed, using the dimension name from the input. | Output references a rubric dimension not present in the input, describes the failure in vague terms, or conflates multiple dimensions. | String-match the cited rubric dimension against the input [RUBRIC_DIMENSIONS] list. Reject if no exact match exists. |
Context State at Failure | Output includes the relevant context window, retrieved documents, or tool outputs present at the time of the root-cause event. | Output describes the failure without showing what the model could see, omits truncated documents, or ignores tool-call results. | Verify the output includes a 'context_state' or equivalent field. Check that the described state matches the trace event's recorded inputs. |
Severity Classification | Output assigns a severity level (e.g., critical, high, medium, low) consistent with the input [SEVERITY_RUBRIC]. | Output assigns a severity that contradicts the input rubric, uses an undefined level, or omits severity entirely. | Validate the severity value against the allowed enum in [SEVERITY_RUBRIC]. Reject unknown values. |
Remediation Suggestion Relevance | Output proposes a remediation step that directly addresses the identified root cause. | Output suggests a generic fix unrelated to the root cause, recommends retrying without changing conditions, or provides no actionable suggestion. | Check that the remediation targets the specific event type identified as the root cause. A retrieval failure should suggest retrieval fixes, not prompt rewrites. |
Confidence and Uncertainty Expression | Output includes a confidence indicator and explicitly notes any trace gaps or ambiguous causal links. | Output expresses certainty when trace evidence is ambiguous, omits confidence entirely, or fails to flag missing trace segments. | Parse for a confidence field or explicit uncertainty language. Flag if the output asserts certainty but the evidence chain has a gap flagged in the manual review. |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base prompt with a single trace and a simplified rubric. Replace [TRACE_DATA] with a JSON dump of one production trace. Replace [RUBRIC_VIOLATION] with a plain-text description of the failed rule. Remove the structured output schema and ask for a free-text chain-of-evidence instead.
Watch for
- The model skipping intermediate steps and jumping to conclusions
- Missing trace event IDs in the explanation
- Overly broad blame assignment (e.g., 'retrieval failed' without specifying which step)

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us