qdrant-model-migration
它能做什么
这份指南可以帮你在不中断服务的情况下,更换 Qdrant 中的嵌入模型(也就是把数据转换为数字以便搜索的模型)。它讲解了如何在应用不下线的前提下,把数据迁移到新模型。
适用场景
- ✓当你想更换将文本转换为数字的模型时。
- ✓当你需要为新模型更新数据,又不希望服务停机时。
- ✓当你想把新模型与旧模型进行对比测试时。
技能链接
https://github.com/github/awesome-copilot/blob/main/skills/qdrant-model-migration/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“如何在 Qdrant 中更换嵌入模型而不造成停机?”
每周 5 个新技能,1 分钟读完。
工作原理
Qdrant 不允许在已有的集合(collection)中添加新类型的“向量”(代表你数据的数字)。因此,你需要创建一个新集合,并迁移数据。为了避免停机,你可以使用“别名”(集合的昵称)来无缝切换集合。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
What to Do When Changing Embedding Models
Vectors from different models are incompatible. You cannot mix old and new embeddings in the same vector space. You also cannot add new named vector fields to an existing collection. All named vectors must be defined at collection creation time. Both migration strategies below require creating a new collection.
- Understand collection aliases before choosing a strategy Collection aliases
Can I Avoid Re-embedding?
Use when: looking for shortcuts before committing to full migration.
You MUST re-embed if: changing model provider (OpenAI to Cohere), changing architecture (CLIP to BGE), incompatible dimension counts across different models, or adding sparse vectors to dense-only collection.
You CAN avoid re-embedding if: using Matryoshka models (use dimensions parameter to output lower-dimensional embeddings, learn linear transformation from sample data, some recall loss, good for 100M+ datasets). Or changing quantization (binary to scalar): Qdrant re-quantizes automatically. Quantization
Need Zero Downtime (Alias Swap)
Use when: production must stay available. Recommended for model replacement at scale.
- Create a new collection with the new model's dimensions and distance metric
- Re-embed all data into the new collection in the background
- Point your application at a collection alias instead of a direct collection name
- Atomically swap the alias to the new collection Switch collection
- Verify search quality, then delete the old collection
Careful, the alias swap only redirects queries. Payloads must be re-uploaded separately.
Need Both Models Live (Side-by-Side)
Use when: A/B testing models, multi-modal (dense + sparse), or evaluating a new model before committing.
You cannot add a named vector to an existing collection. Create a new collection with both vector fields defined upfront:
- Create new collection with old and new named vectors both defined Collection with multiple vectors
- Migrate data from old collection, preserving existing vectors in the old named field
- Backfill new model embeddings incrementally using
UpdateVectorsUpdate vectors - Compare quality by querying with
using: "old_model"vsusing: "new_model" - Swap alias to new collection once satisfied
Co-locating large multi-vectors (especially ColBERT) with dense vectors degrades ALL queries, even those only using dense. At millions of points, users report 13s latency dropping to 2s after removing ColBERT. Put large vectors on disk during side-by-side migration.
If you anticipate future model migrations, define both vector fields upfront at collection creation.
Dense to Hybrid Search Migration
Use when: adding sparse/BM25 vectors to an existing dense-only collection. Most common migration pattern.
You cannot add sparse vectors to an existing dense-only collection. Must recreate:
- Create new collection with both dense and sparse vector configs defined
- Re-embed all data with both dense and sparse models
- Migrate payloads, swap alias
Sparse vectors at chunk level have different TF-IDF characteristics than document level. Test retrieval quality after migration, especially for non-English text without stop-word removal.
Re-embedding Is Too Slow
Use when: dataset is large and re-embedding is the bottleneck.
- Use
update_mode: insert(v1.17+) for safe idempotent migration Update mode - Scroll the old collection with
with_vectors=False, re-embed in batches, upsert into new collection - Upload in parallel batches (64-256 points per request, 2-4 parallel streams) Bulk upload
- Disable HNSW during bulk load (set
indexing_threshold_kbvery high, restore after) - For Qdrant Cloud inference, switching models is a config change, not a pipeline change Inference docs
…
常见问题
我需要重新嵌入所有数据吗?
大多数情况下需要。如果你更换了模型提供商(例如从 OpenAI 换到 Cohere)、模型架构,或生成的数字维度,就需要重新嵌入数据。像“量化”方式(压缩数字)这类小改动可能会被自动处理。
什么是集合别名?
别名就像数据集合的昵称。你的应用不必始终指向确切的集合名称,而是指向一个别名。这样,你只需把别名切换到新集合,就无需修改应用代码。
如果我的数据量非常大怎么办?
对于超大规模的数据集,重新嵌入全部数据可能会很慢。指南建议了一些优化方法,比如暂时关闭 HNSW 索引,并进行并行批量上传,以加快进程。
详情
作者的原始描述
Guides embedding model migration in Qdrant without downtime. Use when someone asks 'how to switch embedding models', 'how to migrate vectors', 'how to update to a new model', 'zero-downtime model change', 'how to re-embed my data', or 'can I use two models at once'. Also use when upgrading model dimensions, switching providers, or A/B testing models.
repo: github/awesome-copilot
热度
- GitHub 星标
- 40k
- 排名
- #7355
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
acquire-codebase-knowledge
40k帮你的智能体理解并编写现有代码项目的文档。它有助于新成员快速上手,或者快速了解项目架构。
acreadiness-assess
40k让你的智能体评估一个项目对 AI 的准备程度,并生成报告。它有助于了解项目在使用 AI 工具方面的准备情况。
acreadiness-generate-instructions
40k帮你的智能体根据评估结果编写 AI 工具的指令文件。它有助于改善 AI 与代码的交互方式,并弥补已发现的不足。
acreadiness-policy
40k让你的智能体协助制定或应用 AI 项目评估的政策。它有助于规范项目的评估方式,并确保合规。