KatInterview

Building a Trustworthy Document Q&A Assistant with Retrieval and LLMs

Machine LearningModel answer
MediumModel answerMachine Learningragretrievalllm

Last updated

Design an internal question-answering assistant that retrieves enterprise documents to ground an LLM, then explain how you would measure, guard, and debug it.

You are interviewing for a senior data scientist position on a team that ships LLM-powered products. Your task is to design an internal question-answering assistant that answers employee questions using the company's own documents (wikis, PDFs, tickets, chat exports). The assistant must ground its answers in retrieved content rather than rely on the model's memory.

Assume the following:

  • The document set changes frequently throughout the day.
  • Answers must be trustworthy and traceable to sources.
  • The system runs under realistic latency and cost limits.

In your answer, cover:

  1. Architecture end to end: ingestion, chunking, embeddings, retrieval, reranking, prompt construction, generation, and citation or grounding.
  2. Retrieval strategy: how you would decide between dense, sparse, or hybrid retrieval.
  3. Trade-offs: latency, cost, freshness, precision versus recall, context window limits, and hallucination risk.
  4. Data hygiene and governance: how you handle missing metadata, stale documents, duplicate content, and documents with restricted access.
  5. Evaluation: offline and online measurement, including answer-quality metrics, business metrics, and guardrail metrics.
  6. Approach choice and failure modes: when you would choose retrieval over fine-tuning, and which problems you expect in production.

State your assumptions about scale and service-level targets explicitly.

Hints

Hint 1

Break the pipeline into stages that can each be measured separately (retrieval recall, rerank precision, faithfulness of the generated answer), so that a bad answer can be traced to the stage that failed.

Hint 2

Treat access control and freshness as hard requirements, not afterthoughts: think about where permission filtering must happen (before ranking, not after) and what the default should be when permissions or metadata are missing.

Hint 3

For the retrieval choice, propose an experiment: build a labeled query set, compare recall per method by query type (exact IDs and acronyms versus paraphrased questions), and let the data justify hybrid search plus a reranker.

Hint 4

For evaluation, separate the layers: retrieval metrics (recall@k, MRR), generation metrics (faithfulness, citation correctness, abstention quality), online business metrics (resolution rate, deflection, feedback), and guardrails (permission leaks, latency, cost).