Data: From Business Records To Model Inputs · Lesson 14

Embeddings And Vector Search Explained

Similarity proposes candidates. Exact identifiers, scope, dates, authorization and source support determine whether a candidate can serve the task.

Study And Save Progress

Watch The Lesson

5 min 40 sec

Read the video transcript

Our fictional returns assistant finds a passage that sounds almost exactly like the customer's question. It concerns the wrong product and an old policy. How can an apparently strong search match still be unusable? Follow a request through numerical similarity, exact identifiers and applicability checks before deciding which evidence can support the answer. An embedding is a numerical representation

produced by a method or model. A sentence embedding can place related meanings near one another under a chosen measure, helping retrieve paraphrases that share few exact words. The representation is a search signal. It does not establish that the content is true, authorized, current or complete, and it should not be treated

as an encrypted version of the source. Use a tiny invented geometry example. The query vector is 1, 0. Candidate A is 0.9, 0.1; B is 0.1, 0.9. Under cosine similarity, A is about 0.994 and B about 0.110.

A points much more nearly in the query's direction. These are 2-dimensional teaching vectors, not the output of a real language embedding model. Their coordinates have no assigned business meanings. Cosine compares direction after accounting for vector lengths. Other measures include inner product and distance, with different assumptions and score conventions. Faiss documentation explains that inner product is not

automatically cosine unless vectors are normalized appropriately. A provider can also transform a similarity into a displayed ranking score. Do not treat our 0.994 as a universal confidence or a vendor's acceptance threshold. A vector index helps search a collection. An exhaustive search can compare all candidates under the chosen metric.

Approximate nearest-neighbor methods reduce parts of that search to improve practical speed or scale, with tradeoffs controlled by the algorithm and configuration. Microsoft's Azure documentation illustrates exhaustive and HNSW approximate search. Even finding the exact nearest vector would not prove that its passage applies to the customer's order. Return to the actual request.

The customer asks about product P101, but a semantically similar passage concerns P107. A lexical or exact-field check can preserve the required identifier. A paraphrase such as send it back may still benefit from semantic matching to return an item. Choose the search mechanism for the constraint: an exact code and a related phrase pose different needs. Pinecone's sparse-retrieval explanation illustrates

token-oriented and dense semantic representations. Sparse representations can also be learned; sparse does not mean every method is simply a literal word counter. Hybrid retrieval combines selected signals, and reranking can reorder retrieved candidates with additional processing. No provider's benchmark or default setting establishes the best configuration for our corpus.

Test the actual identifier, paraphrase, negation and exception cases. Metadata can constrain product, tenant and effective date. Apply the supplied policy-selection rule for the order, keeping historical applicability when needed. A close passage for the wrong customer, product or date remains wrong evidence. Authorization must be enforced by the application and

retrieval design, rather than by asking the model to ignore material it was allowed to receive. Verify the relevant access and revocation paths separately from similarity ranking. Build evaluation cases that expose the difference. Keep a query with an exact product code, a paraphrase, a negated condition and a date-qualified policy question. Establish the required evidence independently,

then compare candidate retrieval and supported explanation. Record embedding model, metric, index settings, filters and reranking so changes can be interpreted. The target is usable evidence for a permitted task, with missing-evidence behavior when no candidate qualifies. Muennighoff and colleagues' M T E B study, first posted in October 2022, evaluated 33 embedding models across 8 tasks.

No one method dominated every task in that study. A model that works well for sentence similarity may therefore need separate examination for the retrieval task we actually have. This is historical benchmark evidence, rather than a current product ranking. Our test should include exact codes, paraphrases, exceptions and applicable dates,

with the required evidence established independently. Here is the checkpoint. Why can a semantically similar paragraph still be the wrong result? Think about what a similarity measure leaves outside its comparison. The passage may concern another product, customer, effective date, jurisdiction or negated condition. Similarity is a useful search signal, while applicability,

permissions and factual support require their own checks. A high score alone cannot settle those requirements. For practice, compare an exact-code requirement with a paraphrase and inspect the tiny vector example. Explain which check would reject a close but inapplicable passage. The worksheet has a separate key. Our initial match becomes useful only when the right evidence survives the relevant constraints and supports the answer.

Next we will distinguish that retrieved evidence from the application's remembered preferences and pending tasks.

Main Point

Similarity proposes candidates. Exact identifiers, scope, dates, authorization and source support determine whether a candidate can serve the task.

Key Points

1. Inspect the geometry

The invented vectors q=(1,0), A=(0.9,0.1), B=(0.1,0.9) give cosine(q,A)=0.9/sqrt(0.82)≈0.993884 and cosine(q,B)=0.1/sqrt(0.82)≈0.110432. A has the closer direction. No coordinate is a business feature or real embedding output. These numbers are not calibrated correctness probabilities or product API scores.

Faiss's pinned metric note explains normalization for cosine versus inner product. Azure's ranking guidance distinguishes exhaustive and approximate search and describes score conventions. [FAISS-METRIC;AZ-RANK]

2. Inspect the service requirement

A request naming P101 cannot be satisfied merely by a close passage about P107. Preserve the exact code in the relevant field or lexical constraint. A paraphrase such as “send it back” may benefit from semantic matching. Sparse methods can be lexical or learned; Pinecone's explanation is one provider's account of the distinction, not a universal performance ranking. [PC-SPARSE]

Hybrid combination and reranking require evaluation on the actual corpus. Relevant tests include exact codes, paraphrases, negation, exceptions and date-qualified policies. Keep product, tenant and effective-date metadata with evidence; enforce authorization outside model instructions and test it.

3. Preserve interpretable comparisons

Version the embedding method, metric, corpus, index settings, filters and ranking stages. Test required evidence and final explanation separately. A nearest result can still be false, stale, unauthorized or inapplicable. An empty qualified result should lead to defined uncertainty behavior, not a fabricated answer. The worksheet checks these distinctions without calling any embedding or search service.

4. A dated example

Muennighoff and colleagues' M T E B study, first posted in October 2022, evaluated thirty-three embedding models across eight tasks. No one method dominated every task in that study. A model that works well for sentence similarity may therefore need separate examination for the retrieval task we actually have. This is historical benchmark evidence, rather than a current product ranking. Our test should include exact codes, paraphrases, exceptions and applicable dates, with the required evidence established independently.

5. Bringing the lesson together

The opening close match remains unusable until product, date and access constraints are satisfied. You can now explain numerical proximity, choose exact and semantic checks and test the actual evidence path.

Learning Checks

Attempt each answer before expanding the reasoning.

M13-L14-Q01

Why can a semantically similar paragraph still be the wrong result? Think about what a similarity measure leaves outside its comparison.

Show reasoning

The passage may concern another product, customer, effective date, jurisdiction or negated condition. Similarity is a useful search signal, while applicability, permissions and factual support require their own checks. A high score alone cannot settle those requirements.

Sources

Learner Materials

Download Lesson 14 Learner Materials

Use the supplied fictional cases and templates for practice.

Practice

Write your answer, compare it with the model answer and decide what to revisit. These written checkpoints are self-assessed.

Here is the checkpoint. Why can a semantically similar paragraph still be the wrong result? Think about what a similarity measure leaves outside its comparison.

Show The Model Answer

The passage may concern another product, customer, effective date, jurisdiction or negated condition. Similarity is a useful search signal, while applicability, permissions and factual support require their own checks. A high score alone cannot settle those requirements.

Compare your reasoning with the model answer. These written checks are self-assessed.

Open Practice And Save Your Work