Design Search Over a Billion Documents

AI ProductsSearch Anthropic

Design a search product over one billion documents that answers questions in plain language. A user types a question; the system finds the most relevant documents and has a language model write an answer that cites them.

Functional:

  • Index one billion documents of about 5 KB each, with updates and deletes flowing in all day.
  • Retrieve the top documents for a query using both keyword and semantic (embedding) matching.
  • Generate a short answer with citations to the retrieved documents, streamed to the user.
  • Show the ranked document list even if answer generation is slow or fails.

Non-functional:

  • 10,000 queries per second at peak.
  • Retrieval under 300 ms at p99; first answer token under 1.5 seconds.
  • A new or changed document is searchable within 5 minutes.
  • No single shard or popular query can take the whole system down.
  • 1 billion documents, about 5 TB of text; embeddings at 768 dimensions.
  • 50 million document updates a day.
  • The model needs about 1 GPU per 20 concurrent answers.

Crawling, ranking model training, and the UI.

Accepted 1/7
Acceptance 14%
System design
Loading editor...