KatInterview

Designing a Copy-Match Service for a Billion-Video Catalog

System DesignModel answer
HardModel answerSystem Designsystem-designvector-searchann

Last updated

Design a pipeline that flags re-uploaded or lightly altered videos against a billion-item catalog within 500 ms at 10k uploads per second, balancing precision and recall.

Scenario

You run the content-integrity team for a large video-sharing platform. When someone uploads a clip, you must decide whether it is essentially a copy of something already in the catalog. A copy here means a video that was only lightly altered: re-compressed, color-graded, watermarked, cropped, or trimmed from a longer source.

Requirements

Functional

  • Check on upload: return a verdict within 500 ms of the upload finishing.
  • Reference index: keep a global searchable index covering 1 billion existing videos.
  • Freshness: a video judged to be unique must become searchable within 5 minutes.

Non-functional

  • Sustain 10,000 uploads per second.
  • Keep precision very high, since wrongly flagging an original creator is costly, while keeping recall high enough to meaningfully reduce infringement.

What to cover

  1. Representation: how do you turn a video into compact vectors that stay stable under minor edits yet separate different videos?
  2. Search architecture: how do you build approximate nearest-neighbor retrieval that works at this size, including sharding, replication, and freshness?
  3. Verification: how do you confirm borderline candidates before any automated action is taken?
  4. Trade-offs: discuss how vector dimensionality, storage cost, and query latency interact.

Include rough capacity numbers, a latency budget, and the failure modes you would watch for.

Hints

Hint 1

Start by clarifying what the 500 ms covers and whether partial copies (a short clip taken from a long video) count. This decides whether you embed whole videos or time segments.

Hint 2

Do the memory math: a billion float vectors at a few hundred dimensions is terabytes. Think about product quantization with a coarse inverted index, then an exact re-rank on a small candidate set stored on SSD.

Hint 3

A single similar frame is weak evidence. Think about checking that matching frames line up consistently in time, down-weighting generic content like black frames and common intros, and routing mid-confidence scores to humans.

Hint 4

For the 5-minute freshness target, consider a small separate index for recent inserts that is queried alongside the large static index, plus handling for two identical uploads arriving seconds apart.