KatInterview

Building a Pipeline for Cross-Modal File Vectorization at Scale

System DesignModel answer
HardModel answerSystem Designml-system-designembeddingsvector-search

Last updated

Design a multi-tenant service that turns uploaded documents, images and videos into searchable vectors, covering ingestion, inference, storage, dedup, re-embedding, and operations.

Your team is building a platform where customers upload files and the platform turns each one into vector embeddings that are stored for search. Supported inputs are documents, images and videos, and every file is at most X MB (pick a value, such as 100 MB, and state it).

Design the end-to-end system. Your answer should cover:

  1. Requirements and scale. Your assumptions about daily volume, peak rate, latency targets, search latency and tenancy.
  2. Ingestion API. How files arrive, how jobs are tracked, and how deletion works.
  3. Validation and preprocessing. Per-modality steps such as text chunking, image resizing, and video frame or clip sampling.
  4. Model choices. Which models you use per modality, and whether you use one shared space or several.
  5. Throughput. Batching, accelerator scheduling, and concurrency controls, including fairness between tenants.
  6. Storage and search. Where vectors and metadata live (vector store vs. relational vs. columnar), and how similarity search works.
  7. Deduplication. How you handle exact and near-identical content.
  8. Reliability. Retries, idempotency, and re-embedding the corpus when the model changes.
  9. Operations. Monitoring, quality evaluation, cost control, privacy and security.

Make your trade-offs explicit and support them with rough numbers.

Hints

Hint 1

Begin with a back-of-envelope estimate: vectors per file for each modality, multiplied by daily uploads, times bytes per vector. The result tells you whether you need quantization and storage tiering.

Hint 2

Separate CPU-bound preprocessing (decoding, OCR, ffmpeg) from GPU inference with a queue in between, so each pool scales on its own signal and video decoding cannot starve the GPUs.

Hint 3

Make every stage idempotent by keying results on (content hash, model version, preprocessing version). That one key gives you safe retries, exact dedup, and a cheap way to tell what a model upgrade needs to recompute.

Hint 4

For model upgrades, think in terms of dual-writing to a new index version, comparing quality offline, then flipping a pointer, with backfills at low priority on spare capacity.