Interview question
Diagnose a RAG quality regression from retrieval and generation evidence
Uses versioned traces and evaluation slices to locate whether a RAG regression came from ingestion, retrieval, context assembly, or generation.
TL;DR
Uses versioned traces and evaluation slices to locate whether a RAG regression came from ingestion, retrieval, context assembly, or generation.
Hypothesis-driven diagnosis, stage-level metrics, version comparison, representative replay, safe rollback, and targeted remediation.
Practice the problem like a real interview: restate, reason, implement, and test.
After a deployment, grounded-answer pass rate falls from 86% to 61% for recently updated policies, while overall latency improves. You receive traces containing ingestion version, embedding model, index namespace, candidate IDs and scores, reranker version, selected context IDs, prompt version, model version, citations, and evaluator outcomes. Produce a diagnosis plan, the safest immediate action, and the evidence required before a permanent fix.
Move to the linked follow-up, next path step, prerequisite, or deeper variant.
Move forward in the planned practice sequence.
Stable slice: old policies -> retrieval recall@10 0.91, groundedness 0.87
Regressed slice: policies updated in last 7 days -> recall@10 0.48, groundedness 0.59
Generation with oracle context -> groundedness 0.90
Deployment changed chunker v3, embedding model, and namespace alias together.
async def diagnose(cases: list[EvalCase], old: Pipeline, new: Pipeline) -> Report:
report = Report()
for case in cases:
before = await old.trace(case.question, actor=case.actor)
after = await new.trace(case.question, actor=case.actor)
report.add(
slice=case.slice,
retrieval_before=recall_at_k(before.candidates, case.relevant_chunks, 10),
retrieval_after=recall_at_k(after.candidates, case.relevant_chunks, 10),
context_before=context_recall(before.context, case.relevant_chunks),
context_after=context_recall(after.context, case.relevant_chunks),
answer_after=groundedness(after.answer, after.context),
oracle_after=groundedness(
await new.generate(case.question, case.oracle_context),
case.oracle_context,
),
versions=after.versions,
)
return report.compare_by_slice_and_version()
The diagnostic replay is O(cases × compared pipeline stages) and should run on a bounded labeled set. Production mitigation must not depend on completing a full-corpus experiment first.
Aporeon is shaped by Aleksandar Tomovski, a software developer with experience on both sides of technical interviews. Content is reviewed for accuracy, natural spoken delivery, useful depth, and honest trade-offs.
Help improve the interview library.
Say thanks with a standalone, one-time $5 contribution. No account required.