Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Diagnose RAG Failures by Layer

HardGenerative AI & LLMs00:00
Practice interviewer
In session
5 left
00:00

Your question is Diagnose RAG Failures by Layer. Take a moment with it on the right.

Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).

You need to log in / sign up to chat or submit.

Problem

Context

FinSure offers an internal support copilot that answers customer-service questions using policy manuals, billing procedures, and compliance FAQs. A large enterprise customer reports that answer quality is inconsistent, but it is unclear whether the root cause is the prompt, retrieval pipeline, or underlying model.

Constraints

  • p95 latency: 2,500ms end-to-end
  • Cost ceiling: $0.03 per request and $18K/month at 20K requests/day
  • Hallucination rate: <2% on a labeled golden set
  • Prompt injection success rate: <1% on adversarial tests
  • The system must cite retrieved sources for factual claims and refuse when evidence is insufficient

Available Resources

  • 120K internal documents (PDFs, HTML help center pages, policy docs, ticket macros)
  • Existing hybrid search stack (BM25 + dense vector search) and document metadata
  • Three approved models: a small fast model, a mid-tier model, and a premium model
  • 400 historical customer questions with human-rated answers, plus 50 known-bad examples from the customer
  • Access to prompt templates, retrieval logs, ranked results, and model outputs

Task

  1. Propose a step-by-step diagnosis plan that isolates whether failures are caused by prompt design, retrieval quality, or model capability.
  2. Define an offline and online evaluation strategy, including how you would build a golden set, measure groundedness, and detect prompt injection or unsupported answers.
  3. Recommend an architecture and experimentation plan to test prompt-only, retrieval-only, and model-only changes while respecting latency and cost constraints.
  4. Write a production-quality prompt and Python implementation for a diagnostic harness that runs ablations and returns structured root-cause signals.
  5. List the most important failure modes, mitigations, and tradeoffs you would communicate to the customer and internal stakeholders.