KatInterview

Design a Hybrid Search System for a Corporate Knowledge Base

Machine LearningModel answer
HardModel answerMachine Learninginformation-retrievalvector-searchranking

Last updated

Design a scalable, low-latency search engine that combines keyword and semantic retrieval over 100M enterprise documents with personalized ranking.

Context

Your company runs an internal knowledge platform where employees publish documentation, project trackers, and support threads. With tens of millions of documents across hundreds of teams, employees routinely fail to surface the right content — especially when they use informal language, team-specific jargon, or don't recall the exact title of a page.

You've been asked to design a search system that solves this problem at scale.

Functional Requirements

  1. Accept free-text queries and return a ranked list of relevant documents.
  2. Support both exact-term matching (e.g., ticket IDs, error codes) and meaning-based similarity (e.g., paraphrases, synonyms).
  3. Incorporate user context — team membership, role, and recent activity — to personalize result ordering.

Non-Functional Requirements

  1. Latency: End-to-end search response within 200ms at the 99th percentile.
  2. Freshness: Newly created or edited content must appear in results within 60 seconds.
  3. Scale: Handle a corpus of 100 million documents and sustain 5,000 queries per second.

Your Task

Walk through the full system design. Your answer should cover:

  • How documents are processed, chunked, embedded, and indexed.
  • The retrieval strategy: how candidates are generated and why a single retrieval method is insufficient.
  • The ranking pipeline: how you move from thousands of candidates to a final top-10 with acceptable latency.
  • How personalization is incorporated without blowing the latency budget.
  • How the system stays fresh — especially for vector indexes, which are expensive to update.
  • What you monitor, and how you measure whether search quality is improving or degrading over time.

Be concrete. Use numbers where they matter. Call out trade-offs and failure modes.

Hints

Hint 1

Start by estimating the size of the vector index before picking an ANN algorithm — at 300M chunk embeddings, quantization and sharding are not optional.

Hint 2

Think about where ACL enforcement happens in the funnel. Post-filtering after retrieval can silently return zero results for users with narrow permissions.

Hint 3

Personalization signals should be precomputed features fed to the ranker, not online model calls — otherwise they blow the latency budget.