Skip to content
Duoduo Mediaevidence to decision

Package 14 · Section 7.1

Tracing Failure Inspection and Root Cause Analysis

Explain why a particular answer or recommendation failed and identify the responsible stage.

Track
D · Inspection, optimization and operations
Level
Practitioner
Version
v1.0
Status
Open · initial release
Explanation depthDepth

Learning objectives

  • Instrument end-to-end traces.
  • Build a failure taxonomy and causal debugging procedure.
  • Separate data, retrieval, prompt, model, tool, policy and decision defects.

In brief

When an answer is wrong, the question is not "what did the model do" but "which stage first went wrong". Traces make that question answerable, and root cause analysis turns the answer into a regression test.

Core concepts

14.1What a trace contains

A trace records every stage of a request: original and rewritten query, route, candidates with scores, reranked list, context, prompt version, model version, output, validation results, latency, tokens and cost.

Traces must be linked to dataset, index and configuration versions so a run can be reproduced.

14.2Earliest failing stage

Walk the pipeline forward and check each stage against gold labels: was the evidence ingested, indexed, retrieved, reranked into context, used by the generator, cited correctly? The first "no" is the earliest failing stage.

Downstream fixes for upstream faults, such as prompt tweaks for retrieval misses, hide the real cause.

14.3Root cause and regression

Ask why the stage failed until you reach a fixable cause: missing metadata, wrong chunk boundary, router rule, prompt ambiguity. Then write a failing test that reproduces the case.

Group incidents into failure families to prioritize systemic fixes over one-off patches.

Worked example

Diagnosing a stale answer

Situation: Answer cites a 2023 travel allowance. Gold evidence is the 2025 revision.

  1. 1Ingested? Yes. Indexed? Yes, but effective_date filter is not applied.
  2. 2Retrieved? 2025 version ranks 4th, 2023 ranks 1st.
  3. 3Router: the date filter is applied only on the vector route; query went keyword-only.
  4. 4Root cause: filter configuration missing from the keyword route.
  5. 5Regression test: query for any superseded policy must not return the old version.

Outcome: Fixing the route configuration resolves 11 related incidents. The prompt was never the problem.

Decision rules

  • Find the earliest failing stage before changing anything.
  • Do not fix upstream faults with downstream patches.
  • Every resolved incident produces a regression test.
  • Classify incidents by family and fix families, not instances.

Common pitfalls

  • Debugging from the final answer only.
  • Traces without version links, making reproduction impossible.
  • Closing incidents without a regression test.

Key vocabulary

Trace
A structured record of every stage of a single request.
Earliest failing stage
The first pipeline stage whose output is wrong for a case.
Failure family
A group of incidents sharing a root cause pattern.
Regression test
A test that fails if a previously fixed defect recurs.

Tutorial outline

  1. 14.1Trace and span structure; request IDs; redaction.
  2. 14.2Reproduction bundles and minimal failing cases.
  3. 14.3Counterfactual replay and stage-level ablation.

Required artifacts

Trace, reproduction bundle, root-cause report, corrective action and regression test.

Evaluation evidence

Reproduction success, causal isolation, fix effectiveness and recurrence prevention.