AI Systems Reference/Knowledge Pipelines

RAG Ingestion at Scale

CDC-driven ingestion, document versioning, embedding backfills, and keeping retrieval fresh without re-indexing the world on every commit.

4/5Overview: 35m

From notebook RAG to production corpus

AI Engineering covers chunking strategies and basic vector search. At scale, the problem becomes a data pipeline:

  • Billions of chunks across tenants
  • Continuous updates from wikis, tickets, code repos
  • Embedding model version changes requiring re-index
  • SLA: "merged doc searchable within N minutes"

Ingestion architecture

Source (Git, Confluence, S3) → CDC/Webhook → Parse → Chunk → Embed → Upsert → Index ↓ Dead-letter, replay
ConcernPattern
TriggerWebhooks on merge; nightly full reconcile
IdempotencyContent-hash as chunk ID — skip unchanged
DeletionTombstone on doc delete; purge vectors by metadata filter
Versioningdoc_id + revision metadata; query latest only

See Databases for CDC patterns — same mechanics, embedding step added.

Chunking at scale

Notebook chunking is manual; production chunking is policy per source type:

SourceStrategy
CodeAST-aware splits, respect function boundaries
Markdown/docsHeader-based sections + overlap
PDFsLayout-aware parsing (not naive page split)
TicketsOne chunk per comment thread

Re-chunking on policy change = full backfill — version your chunker.

Embedding pipelines

  • Batch embed offline for backfill (cheaper, rate-limit friendly)
  • Online embed on hot path only for user queries
  • Pin embedding model version — mixing versions in one index destroys recall

Backfill playbook:

  1. New index with new embeddings (blue)
  2. Dual-write or shadow query both
  3. Compare recall@k on eval set
  4. Cut traffic; delete old index (green)

Freshness vs cost

Every commit ≠ re-embed everything. Use:

  • Diff-based incremental updates
  • Tiered freshness (hot repos: 5 min; archive: weekly)
  • Lazy embed on first query for cold content (trade latency)

Multi-tenant isolation

Enterprise SaaS needs:

  • Namespace per customer in vector DB
  • Row-level security metadata filters
  • Per-tenant ingestion quotas

Cross-tenant leakage is a severity-1 incident — enforce at index and query layers.

Interview framing

"Index 50TB of internal docs":

  1. Object store for raw docs, vector DB for embeddings
  2. Incremental pipeline with content-hash dedup
  3. Blue/green index for embedding model upgrades
  4. Freshness SLO per doc class

Senior signal: Mention parse quality — garbage chunks from bad PDF extraction cause more production pain than wrong HNSW ef_search.

Link forward

Vector Index Operations covers query-time performance, hybrid search, and billion-vector ops.

Further Reading

Hands-On Tasks (Optional)

Design drills and architecture sketches — gateway SLOs, eval gates, rollout plans. Assumes AI Engineering fundamentals are already in place.

  • Design incremental ingestion for a monorepo

    10k repos, ~500 commits/day. Specify trigger (webhook vs poll), chunk keying strategy, stale-chunk deletion, and SLA for "doc searchable after merge."

    25m