Build and Evaluate a Minimal Embedding-Based RAG Pipeline

Quick Overview

Build a minimal retrieval-augmented generation pipeline with transparent ingestion, chunking, embeddings, indexing, retrieval, and prompt assembly. Evaluate retrieval first with known relevant chunks, preserve document provenance, resist prompt injection from sources, and support abstention.

Build and Evaluate a Minimal Embedding-Based RAG Pipeline

Company: Harvey

Role: AI Agent

Category: ML System Design

Difficulty: medium

Interview Round: Onsite

## Interview Prompt Build a small retrieval-augmented generation pipeline over a directory of documents. Explain file ingestion, chunking, embedding, indexing, retrieval, prompt assembly, and answer generation. Then design an evaluation that measures retrieval quality with recall and hit rate before judging answer quality. ### Constraints & Assumptions - Documents may be updated, so chunks need stable provenance and versioning. - The initial implementation should be understandable and testable, not hidden behind a large framework. - Evaluation questions must have known relevant source chunks. - Retrieved text is untrusted data and cannot override system instructions. ### Clarifying Questions to Ask - What document formats and query types must the prototype support? - How many relevant chunks may exist for one evaluation query? - Is answer abstention required when retrieval evidence is weak? ### What a Strong Answer Covers - A reproducible ingestion pipeline with chunk IDs tied to document versions and offsets. - A retrieval interface that exposes scores and supports top-k and metadata filtering. - Ground-truth construction plus hit-rate-at-k and recall-at-k with clear denominators. - Separate retrieval and generation evaluation so a fluent answer cannot hide a retrieval miss. - Security, deletion/update handling, caching, and experiment tracking. ### Follow-up Questions - How would you choose chunk size and overlap using evaluation results? - What would you change if relevant evidence is distributed across several chunks? - How would you compare dense retrieval with a hybrid lexical approach?

Quick Answer: Build a minimal retrieval-augmented generation pipeline with transparent ingestion, chunking, embeddings, indexing, retrieval, and prompt assembly. Evaluate retrieval first with known relevant chunks, preserve document provenance, resist prompt injection from sources, and support abstention.

|Home/ML System Design/Harvey
Harvey logo
Harvey
Aug 14, 2026
mediumAI AgentOnsiteML System Design
3
0

Interview Prompt

Build a small retrieval-augmented generation pipeline over a directory of documents. Explain file ingestion, chunking, embedding, indexing, retrieval, prompt assembly, and answer generation. Then design an evaluation that measures retrieval quality with recall and hit rate before judging answer quality.

Constraints & Assumptions

  • Documents may be updated, so chunks need stable provenance and versioning.
  • The initial implementation should be understandable and testable, not hidden behind a large framework.
  • Evaluation questions must have known relevant source chunks.
  • Retrieved text is untrusted data and cannot override system instructions.

Clarifying Questions to Ask Guidance

  • What document formats and query types must the prototype support?
  • How many relevant chunks may exist for one evaluation query?
  • Is answer abstention required when retrieval evidence is weak?

What a Strong Answer Covers Guidance

  • A reproducible ingestion pipeline with chunk IDs tied to document versions and offsets.
  • A retrieval interface that exposes scores and supports top-k and metadata filtering.
  • Ground-truth construction plus hit-rate-at-k and recall-at-k with clear denominators.
  • Separate retrieval and generation evaluation so a fluent answer cannot hide a retrieval miss.
  • Security, deletion/update handling, caching, and experiment tracking.

Follow-up Questions Guidance

  • How would you choose chunk size and overlap using evaluation results?
  • What would you change if relevant evidence is distributed across several chunks?
  • How would you compare dense retrieval with a hybrid lexical approach?

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...