AI BENCHNOTES
Context windowsBENCH NOTE 003EmbeddingsRAG
AI BENCHNOTES
THE COMPLETE WORKBENCHPick a machine part.
12 NOTES / 12 LABS / ZERO INCENSE

Start anywhere. The numbers are a useful route, not homework police.

00Animated bench map
CONCEPT 003 coordinates for vibes

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 prose
  • a database ID
  • a human-readable taxonomy
SEMANTIC_ATLAS / SHEET 003NOT TO SCALE
INPUT SPECIMEN“a quiet café for writing”
[−0.018+0.442+0.091−0.733+0.206…]
quiet cafélanded near: library, study nook, coworking
one item learned relationshipTHE AXES DO NOT COME WITH LABELS.
01 / THE SHORT VERSION

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.

  1. 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
  2. 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, …]
  3. 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
02 / SEMANTIC CONSTELLATION

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.

PROJECTED_VIEW.SKY QUERY LOCKED
QUERYsomewhere quiet to work with Wi-Fi
NEAREST NEIGHBORS
  1. library study roomquiet + work0.92
  2. calm coworking spacework + Wi-Fi0.88
  3. 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.

03 / THE COMPASS

“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.

FIELD RULE

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.

04 / DISPATCH DESK

Three jobs for one strange little map.

SEARCH
CASE FILE 01

Find by meaning, not only keywords

“refund after trial” can find a document titled “subscription cancellation policy.”

GROUP
CASE FILE 02

Cluster an unlabeled pile

Group support tickets into recurring themes before anyone has named the themes.

SUGGEST
CASE FILE 03

Generate recommendation candidates

Retrieve items near a user or product vector, then let a ranking system apply business constraints.

05 / SHIPPING THE ATLAS

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.

VECTOR SPACE PASSPORTDO NOT MIX MAPSvalid only for one embedding contract
  1. 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.

  2. 02

    Version the atlas

    Store the model name, version, vector dimension, normalization choice, and index metric beside the data.

  3. 03

    Re-index on model change

    Coordinates from different embedding models are not safely comparable. A new model means a new coordinate system.

  4. 04

    Evaluate your neighborhood

    Measure retrieval on real queries, including confusing negatives. Pretty demos are not recall metrics.

06 / HERE BE DRAGONS

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.”
07 / IMPLEMENTATION RECEIPT

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.

VECTOR MARTORDER #003-NEARBY
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

FOLD THIS INTO YOUR WALLET
  • Same space before similarity.
  • Metric choice changes ranking.
  • Exact facts still deserve exact filters.
  • Evaluate neighbors on your own data.