← Back to Work

Selected case studies · SYSTEM

Generative AI (K-Bot) Vector DB Structure Design & Embedding Migration

A partition-key multi-tenant design and an embedding-model swap that never stops the service

Role
Backend · Database
Period
2025.11 ~ 2026.04
Stack
Python · Vector DB · Embeddings · WebSocket

01 / Problem

Collections and partitions grew with every customer and file, while embedding-model changes made the existing vector space incompatible with search.

02 / Constraints

  1. 01

    Existing documents had to be re-embedded without stopping the service.

  2. 02

    Long-running jobs needed pause, resume, retry, and concurrency controls.

  3. 03

    Deleted documents could not reappear in the new collection.

03 / Decisions & approach

01

Shared collections with partition keys

Collections are shared by model and dimension, while tenants stay isolated by partition key.

02

Data migration, not a setting change

Model replacement became an explicit prepare → re-embed → verify → apply workflow.

03

Final apply gate

The service keeps using the old collection until the new one passes verification.

04 / System flow

Embedding migration flow

  1. 01

    Prepare

    Create collection

  2. 02

    Migrate

    Batch re-embed

  3. 03

    Verify

    Check count + consistency

  4. 04

    Apply

    Switch service

  5. 05

    Observe

    Track failure + recovery

05 / Outcome

  • Physical collection growth no longer scales with every customer and file.
  • Operators can control progress and failures while replacing a model without downtime.

06 / Lessons

An embedding-model replacement is a data migration with retry and consistency requirements, not a config deployment.