Meaning gets a map.
An embedding model turns an item into learned coordinates. Put many items in the same space, and useful relationships become distances and directions a machine can compare.
compressed prosea database IDa human-readable taxonomy
A coordinate is useful because of its neighborhood.
No single number means “train” or “romantic.” The representation was learned across many dimensions, and individual axes are usually not clean human concepts. Meaning emerges from relative geometry.
- 01
Give the model an item
Text, an image, a product, or another input type the chosen embedding model was trained to accept.
night train through Europe - 02
Receive a vector
A fixed-length list of numbers: one location in that model’s learned, many-dimensional space.
[0.12, −0.44, 0.08, …] - 03
Compare locations
A distance or similarity function ranks which other vectors are nearby. The ranking is the useful part.
rail pass · sleeper car · Eurail
Ask the map what lives nearby.
Switch the query. The closest items change because similarity is relative to the query’s coordinate. Then try the ambiguous query and watch “near” become useful-but-messy.
- library study roomquiet + work0.92
- calm coworking spacework + Wi-Fi0.88
- laptop-friendly caféwork + Wi-Fi0.84
Important: this is a hand-authored 2D teaching map. Real embeddings usually have hundreds or thousands of learned dimensions, and a projection can distort which points look close.
“Similar” needs a measuring stick.
The embedding model makes the map. A similarity function decides how to measure it. These choices can rank the same candidates differently.
Cosine
Do the arrows point the same way?Compares angle and ignores overall length. Common for semantic similarity, especially with normalized vectors.
Dot product
Same direction—and how long are the arrows?Includes vector magnitude. That can be useful, but large norms may influence ranking.
Euclidean
How far apart are the endpoints?Measures straight-line distance. For normalized vectors, its ranking is closely related to cosine.
Use the metric recommended for your embedding model and index. If you normalize vectors, document where it happens. “We use vectors” is not a complete retrieval design.
Three jobs for one strange little map.
Find by meaning, not only keywords
“refund after trial” can find a document titled “subscription cancellation policy.”
Cluster an unlabeled pile
Group support tickets into recurring themes before anyone has named the themes.
Generate recommendation candidates
Retrieve items near a user or product vector, then let a ranking system apply business constraints.
Coordinates only make sense in their own atlas.
A vector has no universal address. Change the model and every item may move—even if the output has the same number of dimensions.
- 01
Embed both sides
Queries and candidates must be represented in a compatible space. For text search, use the same model—or its explicitly paired query/document modes.
- 02
Version the atlas
Store the model name, version, vector dimension, normalization choice, and index metric beside the data.
- 03
Re-index on model change
Coordinates from different embedding models are not safely comparable. A new model means a new coordinate system.
- 04
Evaluate your neighborhood
Measure retrieval on real queries, including confusing negatives. Pretty demos are not recall metrics.
Distance is a clue, not a verdict.
An embedding captures patterns useful for the task it learned. It does not certify relevance, correctness, fairness, or safety.
Near is not true
Similarity can surface plausible material that is outdated, factually wrong, or opposed to the query. Retrieval still needs filters, provenance, and verification.
Tiny words can flip intent
Negation, quantities, exact codes, and dates may matter more than their geometric footprint suggests. Hybrid lexical + vector search is often stronger than either alone.
Ambiguity makes split neighborhoods
“Jaguar maintenance” may mean a car or a cat. Add context, classify intent, or retrieve diverse candidates instead of trusting one nearest point.
The map inherits its training
Learned spaces can encode social and cultural biases. Test downstream rankings across groups and domains; do not treat distance as neutral ground truth.
NOTE TO FUTURE SELFA semantic score is not a confidence score. It says “near in this space,” not “safe to ship.”
Embed once. Compare many times. Keep the contract.
A minimal semantic-search path has two phases: index candidates ahead of time, then embed each incoming query into the compatible space.
const contract = {
model: "your-embedding-model@version",
dimensions: EXPECTED_DIMENSIONS,
metric: "cosine",
};
// Offline: map every chunk into this coordinate system.
const documentVectors = await embed(chunks, contract.model);
await index.upsert(documentVectors.map((vector, i) => ({
id: chunks[i].id,
vector,
text: chunks[i].text,
contract,
})));
// Online: put the query in the same space, then look nearby.
const [queryVector] = await embed([query], contract.model);
const candidates = await index.nearest(queryVector, {
metric: contract.metric,
topK: 8,
});MODEL CONTRACTstored
QUERY + DOCUMENT SPACEcompatible
RESULTcandidates, not truth
- Same space before similarity.
- Metric choice changes ranking.
- Exact facts still deserve exact filters.
- Evaluate neighbors on your own data.