Different embedding models

Take your time, follow the code and check your understanding.

The codeRAG fundamentals
doc_vectors = model_a.embed(chunks)
query_vector = model_b.embed(question)
results = nearest(doc_vectors, query_vector)
Your answer4 min · no timer
What needs fixing?

Show solution and explanation

Each embedding model defines its own vector space, and sizes can differ. Index and query vectors must come from the same model and settings. Re-embed everything when you switch models.

Vectors from different models live in different spaces, so the scores are meaningless. Use the same model for documents and queries.