Prompt
vector search returns bad matches after re-embedding
Latest observation
If vector search starts returning bad matches after a re-embedding, the most common cause is embedding inconsistency rather than the search engine itself. Here’s a practical checklist to diagnose and fix it.
Common causes
1. Query embeddings and document embeddings are from different models
If you re-embedded the documents but did not re-embed the query with the same model, results can degrade badly.
Fix:
- Use the same embedding model/version for both indexing and querying.
- If you changed models, re-embed everything, including any cached query embeddings.
2. Old and new embeddings are mixed in the same index
If some vectors were generated with the old model and some with the new one, the vector space is inconsistent.
Symptoms:
- Some searches are good, some are nonsense.
- Results vary depending on which chunk/doc is hit.
Fix:
- Rebuild the index from scratch, or
- Store model/version metadata and filter so only vectors from one embedding space are queried.
3. Vector normalization changed
If the old embeddings were normalized and the new ones are not, or vice versa, similarity scores can shift a lot.
Fix:
- Check whether your index uses cosine, dot product, or L2 distance.
- Make sure the embedding preprocessing matches what the model expects.
- For cosine similarity, normalize consistently.
4. Chunking changed
A re-embedding often happens together with new chunking, which can affect retrieval quality more than the model itself.
Problems:
- Chunks too large → embeddings become generic.
- Chunks too small → lose context.
- Overlapping changed → duplicate or noisy matches.
Fix:
- Compare old vs new chunk sizes, overlap, and boundaries.
- Re-tune chunking for your content type.
5. Index parameters are not tuned for the new embedding space
ANN indexes like HNSW, IVF, FAISS, etc. can behave differently with a new embedding distribution.
Fix:
- Rebuild the index after re-embedding.
- Re-tune parameters like
efSearch,M,nprobe, or equivalent. - If the new embeddings have lower/higher dimensionality, ensure the index supports it.
6. Similarity metric no longer matches the model
Some models work best with cosine similarity; others with dot product. If you changed models, the recommended metric may also have changed.
Fix:
- Check the embedding provider’s guidance.
- Confirm the metric used by the vector database matches the model’s recommended usage.
7. The re-embedding pipeline introduced data issues
Examples:
- Truncated text
- Wrong language
- Boilerplate added/removed
- HTML/markdown cleaned differently
- Encoding issues
Fix:
- Compare a few original inputs vs re-embedded inputs.
- Log and inspect the exact text passed into the embedding model.
Fast debugging steps
- Pick one known query
- Embed it with the new model
- Search against:
- only new embeddings
- only old embeddings
- mixed embeddings
- Compare top results and scores
If the new-only index works but mixed doesn’t, the issue is mixing spaces.
If both are bad, the problem is likely chunking, preprocessing, or model choice.
Best practices
- Store:
- embedding model name
- model version
- normalization setting
- chunking config
- index metric
- Rebuild the vector index when changing models
- Re-embed queries and documents together
- Keep a small evaluation set of query → expected top docs to regression-test retrieval quality
If you want the shortest likely answer
You probably re-embedded documents but left old embeddings or query embeddings in a different vector space. Rebuild the index and re-embed queries with the same model, using the same normalization and similarity metric.
If you want, I can help you debug this with a specific setup like Pinecone, FAISS, Weaviate, pgvector, or Elasticsearch.