Lakshya

AI from First Principles · Chapter 4

Embeddings, without the mathematics

The idea behind search, retrieval and most “AI similarity” features.

An embedding turns text into a list of numbers — a point in space — chosen so texts with similar meaning land near each other. “Cancel my subscription” and “how do I stop being billed” land close together despite sharing almost no words.

That is the whole concept. Semantic search, vector search and similarity matching are all: embed the query, find the nearest stored points, return what they came from.

Three things a reviewer needs to know

  • Embeddings are not encryption and not anonymisation. Text can be substantially recovered from its embedding, so a vector store holding customer data is a store of customer data with the same classification, retention and access requirements as the source. Treat “it's only vectors” as a finding, not a mitigation.
  • The vector store needs access control matching the source. The classic failure: documents access-controlled in SharePoint get embedded into one index every employee can query, and the permission model is silently gone. This is the most common real AI data incident, and it has nothing to do with the model.
  • Similar is not relevant. Nearest-neighbour returns the closest thing in the index even when nothing in it is any good. An empty or wrong index does not error — it confidently returns its best bad match.

A question that finds real problems in five minutes

“Show me two users with different permissions asking the assistant the same question.”

If both get the same answer, the permission model did not survive the trip into the index. No tooling required, and it finds a serious issue often enough to be worth making routine.

← Why it sounds certain when it is wrongRAG — what it fixes and what it does not →