Design an ML search system with RAG evaluates ML product requirements, data/labeling, modeling, serving architecture, evaluation, monitoring, and trade-offs in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.
Design an ML-powered enterprise search system using Retrieval-Augmented Generation (RAG).
Context and constraints:
- Corpus: 5M documents (avg 2 KB) from PDFs/web pages/tickets; updates must be searchable within 5 minutes.
- Traffic: 300 QPS; multi-tenant with per-document ACLs.
- SLOs: p95 latency ≤ 1.2 s end-to-end; budget ≤ $0.002 per query.
Sub-questions:
(a) Ingestion and chunking: parsing, deduplication, metadata extraction, embedding generation, chunk-size strategy, versioning, and incremental updates.
(b) Indexing and retrieval: hybrid sparse+vector (BM25 + ANN), metadata filters, tenant isolation, query understanding/reformulation, top-k selection, and cross-encoder reranking.
(c) Generation: prompt design, grounding with citations, constrained decoding, tool usage, streaming responses, and multilingual handling.
(d) Guardrails and safety: hallucination reduction, citation enforcement, out-of-policy refusal, PII/security controls, and ACL-aware retrieval.
(e) Evaluation and monitoring: offline metrics (NDCG@k, recall@k, answer faithfulness), online A/B tests, user feedback loops, drift/latency/cost monitoring.
(f) Architecture and scaling: service decomposition, model hosting/batching, caching, vector store selection, backpressure, failover, and disaster recovery.
(g) Cost and latency calculations: derive per-stage latency/cost, capacity plan for embeddings, ANN index size, and compute requirements. Justify model choices under constraints.
Quick Answer: Design an ML search system with RAG evaluates ML product requirements, data/labeling, modeling, serving architecture, evaluation, monitoring, and trade-offs in a realistic interview setting. A strong answer states assumptions, handles edge cases, explains trade-offs, and shows how to validate the result clearly.
hardMachine Learning EngineerTechnical ScreenML System Design
56
0
Design an ML search system with RAG
System Design: ML-Powered Enterprise Search with RAG
Design an ML-powered enterprise search system using Retrieval-Augmented Generation (RAG) under the following context and constraints.
Context and Constraints
Corpus: 5M documents (avg 2 KB each) sourced from PDFs, web pages, and support tickets.
Freshness: Updates must be searchable within 5 minutes end-to-end.
Traffic: 300 QPS, multi-tenant with per-document ACLs (users/groups/roles).
SLOs: p95 latency ≤ 1.2 s end-to-end; budget ≤ $0.002 per query.
Assume textual content (no heavy images), standard enterprise auth (OIDC/SAML), and typical query lengths (short questions/keywords). If not stated, make minimal, reasonable assumptions to complete the design.
Sub-Questions
(a) Ingestion and chunking: Describe parsing, deduplication, metadata extraction, embedding generation, chunk-size strategy, versioning, and incremental updates.
(b) Indexing and retrieval: Propose a hybrid sparse+vector approach (BM25 + ANN), metadata filters, tenant isolation, query understanding/reformulation, top-k selection, and cross-encoder reranking.
(c) Generation: Outline prompt design, grounding with citations, constrained decoding, tool usage, streaming responses, and multilingual handling.
(d) Guardrails and safety: Methods for hallucination reduction, citation enforcement, out-of-policy refusal, PII/security controls, and ACL-aware retrieval.
(e) Evaluation and monitoring: Offline metrics (e.g., NDCG@k, recall@k, answer faithfulness), online A/B tests, user feedback loops, and drift/latency/cost monitoring.
(f) Architecture and scaling: Service decomposition, model hosting/batching, caching, vector store selection, backpressure, failover, and disaster recovery.
(g) Cost and latency calculations: Derive per-stage latency/cost, capacity plan for embeddings, ANN index size, and compute requirements. Justify model choices under the constraints.
Constraints & Assumptions
Preserve the scope, facts, inputs, and requested outputs from the prompt above.
If the prompt leaves a detail unspecified, state a reasonable assumption before relying on it.
Keep the answer interview-ready: concise enough to present, but concrete enough to implement or evaluate.
Clarifying Questions to Ask Guidance
Clarify users, core use cases, read/write patterns, scale, latency, availability, and data retention.
State explicit assumptions before making sizing or architecture decisions.
Prioritize the functional path first, then address reliability, security, observability, and rollout.
What a Strong Answer Covers Guidance
A scoped requirements summary with concrete non-goals and success metrics.
ML-specific data, model, evaluation, serving, and monitoring choices.
Reasoned trade-offs among simple and scalable designs, including bottlenecks and failure modes.
A validation, monitoring, migration, and launch plan appropriate for the risk level.
Follow-up Questions Guidance
What breaks first at 10x traffic or data volume?
How would you degrade gracefully during dependency failures?
What metrics and alerts would prove the design is healthy after launch?