

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Semantic Search
incomplete
2: Embeddings
incomplete
3: Embedding Models
incomplete
4: Model Selection
incomplete
5: Vector Operations
incomplete
6: Dimensions
incomplete
7: Dot Product Similarity
incomplete
8: Cosine Similarity
incomplete
9: Why Cosine Similarity?
incomplete
10: Generating Text Embeddings
incomplete
11: Document Embeddings
incomplete
12: Query Embeddings
incomplete
13: Same Model
incomplete
14: Implementing Semantic Search
incomplete
15: Locality-Sensitive Hashing
incomplete
16: Vector Databases
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
You must use the same embedding model for both documents and queries. Different models create incompatible vector spaces. Everything in Magical Vector Land is relative. The word "king" might embed to [0.5, 0.2, 0.1] in one model and [0.6, 0.3, 0.2] in another.
# Correct -- same model
model = SentenceTransformer("all-MiniLM-L6-v2")
doc_embeddings = model.encode(documents)
query_embeddings = model.encode(queries)
# Wrong -- different models create incompatible spaces
doc_model = SentenceTransformer("all-MiniLM-L6-v2")
query_model = SentenceTransformer("all-mpnet-base-v2")
If you get an error about your GPU or hardware acceleration, load the model on your CPU instead by passing device="cpu".
Why is this? Each model learns a different mathematical space. Comparing vectors from two models is like comparing GPS coordinates with street addresses: they're incompatible.