{"course":{"slug":"ai-actually-explained","title":"AI, Actually Explained","url":"https://addaly.com/learn/ai-actually-explained","level":"beginner","track":"start"},"lesson":{"slug":"embeddings-meaning-as-position","title":"Meaning as a position in space","url":"https://addaly.com/learn/ai-actually-explained/embeddings-meaning-as-position","position":24,"of":92,"minutes":10,"answer":"Embeddings encode text as vectors useful for particular similarity tasks. They can retrieve related passages, but topical similarity is not agreement or truth; sentiment and fairness require their own evaluation.","keyIdea":"Embeddings encode text as vectors useful for particular similarity tasks. They can retrieve related passages, but topical similarity is not agreement or truth; sentiment and fairness require their own evaluation."},"body":{"format":"markdown","text":"## The idea under search, recommendation and memory\n\nAn **embedding** is a numerical representation used in many semantic-search, recommendation, clustering and document-retrieval systems. It is not the only way to build these tools, but it is worth understanding because it turns a comparison between texts into a computation on vectors.\n\nA text embedding might contain three hundred and eighty-four, seven hundred and sixty-eight, or another number of coordinates. Training can arrange these vectors so that a chosen similarity measure is useful for a task. “Nearby” means nearby under that representation and measure, not an objective map of all meaning.\n\nA semantic-search model might place “doctor” near “physician”, or match “my car will not start” to “vehicle trouble in the morning”. These are examples of the sort of relationship we want it to learn; their actual scores must be measured with the chosen model.\n\nA pure exact-word match can miss that car-and-vehicle connection. An embedding can help, while a keyword system with synonyms or a hybrid retriever may help too. Compare approaches on real questions rather than assuming one always wins.\n\n## Why closeness means anything at all\n\nThe coordinates are learned rather than assigned by a dictionary editor. A useful intuition is that words or passages occurring in related contexts can acquire related representations. Modern embedding objectives differ, so that intuition is a starting point, not the full training recipe.\n\nFor example, training on related sentence pairs can encourage a useful relationship between “doctor” and “physician”. The result depends on the data and objective. A vector records what training made useful; it is not a certificate that two expressions are interchangeable in every context.\n\n**Cosine similarity** compares vector directions: it is the cosine of their angle, equivalently their normalised dot product. A value near one means similar directions. What a score near zero or any other threshold means for relevance depends on the model and task. Similar direction alone does not establish identical meaning or truth.\n\n## The famous trick, and what is exaggerated about it\n\nA famous illustration from word-vector research is “king minus man plus woman is close to queen”. The 2013 word2vec work demonstrated that some semantic and syntactic relationships could be recovered through vector operations.\n\nThe result depends on the trained vectors, the similarity measure and which candidate words are allowed. It is not a general-purpose machine for doing arithmetic on meanings. When checking an analogy, record those conditions and inspect more than one attractive example.\n\nThis is worth knowing not as trivia but as an example of a pattern: a striking result becomes a slogan, the slogan drops the conditions, and the conditions were where the honesty lived.\n\n## What you can build with it\n\nThe practical recipe is short, and the free tools are excellent.\n\n1. Split material into coherent chunks that fit the embedding model’s token limit. Keep source and page identifiers with them.\n2. Embed each chunk. The model `all-MiniLM-L6-v2`, usable through `sentence-transformers`, produces 384-dimensional vectors and can run on a CPU. Its model card says inputs longer than 256 wordpieces are truncated by default, so a few hundred words may be too long. Speed depends on the hardware and batching.\n3. Store the vectors alongside the original text and its provenance.\n4. Embed a question compatibly and retrieve candidate chunks using an appropriate similarity measure. Test whether they actually answer the question.\n\nThat is one semantic-retrieval recipe. A document-chat system can then provide selected passages to a language model. Other products use lexical or hybrid search, rerankers or direct long-context input, so the interface label alone does not reveal its machinery.\n\nFor a small collection, a matrix of vectors and a direct similarity calculation may be enough. Measure its latency and memory use instead of assuming a universal hundred-thousand-chunk threshold or millisecond speed. Systems such as Chroma or Qdrant add storage and query features; FAISS is a vector-search library. Filtering, access control, updates and persistence also influence the choice.\n\n## The trap that catches everybody once\n\nRelated context is not the same as agreement. An embedding useful for topical retrieval may put opposite opinions near one another. A model trained specifically for sentiment may separate them better, so this is a task-dependent risk rather than a law of every embedding.\n\n“This film was excellent” and “this film was terrible” share a topic and much of their wording. A general-purpose similarity model might match them closely. Before using nearest examples as a complaints classifier, test positive and negative messages, inspect mistakes and compare a classifier trained for that decision.\n\nRepresentations can also carry harmful associations. Bolukbasi and colleagues’ 2016 study demonstrated gender stereotypes in particular word embeddings trained on Google News. Such findings are a reason to test downstream applications for unfair outcomes; they do not prove how any specific hiring product behaves.\n\nUse embeddings as evidence for a defined retrieval or prediction task, and evaluate that task. Similarity alone is not a check of truth, entailment or fairness. A retrieved passage still needs to be read and compared with the question.\n\n## Why this lesson matters more than it looks\n\nWhen an assistant says it “remembers documents” or “finds similar cases”, ask how the product implements that claim. Embeddings may be involved, but so may ordinary search, summaries, databases and other components. Knowing the retrieval path helps you investigate a wrong file or a missing source."},"check":{"question":"A nearest-example triage tool routes many enthusiastic thank-you messages about a product into its complaints queue. Which is a plausible failure to investigate in a general-purpose embedding system?","options":[{"text":"The embedding model was too small at 384 dimensions to separate the two classes, and a larger model would fix it.","correct":false,"tempting":"Dimension count alone does not diagnose the error or guarantee a fix. The training objective, examples and decision rule matter."},{"text":"The representation may emphasise a shared topic more than positive versus negative sentiment, making opposite opinions close under its similarity measure.","correct":true},{"text":"The labelled examples were imbalanced, with too many complaints, biasing every match towards that class.","correct":false,"tempting":"Imbalance can affect a nearest-example system too, but this option assumes a dataset problem not established by the question. Inspect it rather than ruling it out."},{"text":"Cosine similarity ignores the direction of the vectors and measures only their length.","correct":false,"tempting":"Cosine similarity compares directions, equivalently the normalised dot product; it does not measure only length."}]},"prev":{"slug":"attention-what-it-does","title":"Attention, without a single equation","url":"https://addaly.com/learn/ai-actually-explained/attention-what-it-does"},"next":{"slug":"the-context-window","title":"The desk it works on, and what falls off it","url":"https://addaly.com/learn/ai-actually-explained/the-context-window"},"authorship":"Founder and series editor: Dr Mustafa Mun. Written by AI models to a written standard. Source and assessment review continues. Academic review invited.","review":{"status":"Draft, open for academic review"},"cite":"Addaly (2026) 'Meaning as a position in space', in AI, Actually Explained. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/ai-actually-explained/embeddings-meaning-as-position (Accessed: 29 November 2026).","licence":{"name":"CC BY-NC-SA 4.0","url":"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"reader":{"schema":1,"title":"Meaning as a position in space","courseTitle":"AI, Actually Explained","module":{"index":3,"slug":"how-a-chatbot-works","title":"What a chatbot is actually doing"},"answer":null,"keyIdea":"Embeddings encode text as vectors useful for particular similarity tasks. They can retrieve related passages, but topical similarity is not agreement or truth; sentiment and fairness require their own evaluation.","hero":{"kind":"plate","image":null,"alt":null,"caption":null},"blocks":[{"t":"h2","id":"the-idea-under-search-recommendation-and-memory","runs":[{"text":"The idea under search, recommendation and memory"}]},{"t":"p","runs":[{"text":"An "},{"text":"embedding","b":true},{"text":" is a numerical representation used in many semantic-search, recommendation, clustering and document-retrieval systems. It is not the only way to build these tools, but it is worth understanding because it turns a comparison between texts into a computation on vectors."}]},{"t":"p","runs":[{"text":"A text embedding might contain three hundred and eighty-four, seven hundred and sixty-eight, or another number of coordinates. Training can arrange these vectors so that a chosen similarity measure is useful for a task. “Nearby” means nearby under that representation and measure, not an objective map of all meaning."}]},{"t":"p","runs":[{"text":"A semantic-search model might place “doctor” near “physician”, or match “my car will not start” to “vehicle trouble in the morning”. These are examples of the sort of relationship we want it to learn; their actual scores must be measured with the chosen model."}]},{"t":"p","runs":[{"text":"A pure exact-word match can miss that car-and-vehicle connection. An embedding can help, while a keyword system with synonyms or a hybrid retriever may help too. Compare approaches on real questions rather than assuming one always wins."}]},{"t":"h2","id":"why-closeness-means-anything-at-all","runs":[{"text":"Why closeness means anything at all"}]},{"t":"p","runs":[{"text":"The coordinates are learned rather than assigned by a dictionary editor. A useful intuition is that words or passages occurring in related contexts can acquire related representations. Modern embedding objectives differ, so that intuition is a starting point, not the full training recipe."}]},{"t":"p","runs":[{"text":"For example, training on related sentence pairs can encourage a useful relationship between “doctor” and “physician”. The result depends on the data and objective. A vector records what training made useful; it is not a certificate that two expressions are interchangeable in every context."}]},{"t":"p","runs":[{"text":"Cosine similarity","b":true},{"text":" compares vector directions: it is the cosine of their angle, equivalently their normalised dot product. A value near one means similar directions. What a score near zero or any other threshold means for relevance depends on the model and task. Similar direction alone does not establish identical meaning or truth."}]},{"t":"h2","id":"the-famous-trick-and-what-is-exaggerated-about-it","runs":[{"text":"The famous trick, and what is exaggerated about it"}]},{"t":"p","runs":[{"text":"A famous illustration from word-vector research is “king minus man plus woman is close to queen”. The 2013 word2vec work demonstrated that some semantic and syntactic relationships could be recovered through vector operations."}]},{"t":"p","runs":[{"text":"The result depends on the trained vectors, the similarity measure and which candidate words are allowed. It is not a general-purpose machine for doing arithmetic on meanings. When checking an analogy, record those conditions and inspect more than one attractive example."}]},{"t":"p","runs":[{"text":"This is worth knowing not as trivia but as an example of a pattern: a striking result becomes a slogan, the slogan drops the conditions, and the conditions were where the honesty lived."}]},{"t":"h2","id":"what-you-can-build-with-it","runs":[{"text":"What you can build with it"}]},{"t":"p","runs":[{"text":"The practical recipe is short, and the free tools are excellent."}]},{"t":"ol","start":1,"items":[[{"text":"Split material into coherent chunks that fit the embedding model’s token limit. Keep source and page identifiers with them."}],[{"text":"Embed each chunk. The model "},{"text":"all-MiniLM-L6-v2","code":true},{"text":", usable through "},{"text":"sentence-transformers","code":true},{"text":", produces 384-dimensional vectors and can run on a CPU. Its model card says inputs longer than 256 wordpieces are truncated by default, so a few hundred words may be too long. Speed depends on the hardware and batching."}],[{"text":"Store the vectors alongside the original text and its provenance."}],[{"text":"Embed a question compatibly and retrieve candidate chunks using an appropriate similarity measure. Test whether they actually answer the question."}]]},{"t":"p","runs":[{"text":"That is one semantic-retrieval recipe. A document-chat system can then provide selected passages to a language model. Other products use lexical or hybrid search, rerankers or direct long-context input, so the interface label alone does not reveal its machinery."}]},{"t":"p","runs":[{"text":"For a small collection, a matrix of vectors and a direct similarity calculation may be enough. Measure its latency and memory use instead of assuming a universal hundred-thousand-chunk threshold or millisecond speed. Systems such as Chroma or Qdrant add storage and query features; FAISS is a vector-search library. Filtering, access control, updates and persistence also influence the choice."}]},{"t":"h2","id":"the-trap-that-catches-everybody-once","runs":[{"text":"The trap that catches everybody once"}]},{"t":"p","runs":[{"text":"Related context is not the same as agreement. An embedding useful for topical retrieval may put opposite opinions near one another. A model trained specifically for sentiment may separate them better, so this is a task-dependent risk rather than a law of every embedding."}]},{"t":"p","runs":[{"text":"“This film was excellent” and “this film was terrible” share a topic and much of their wording. A general-purpose similarity model might match them closely. Before using nearest examples as a complaints classifier, test positive and negative messages, inspect mistakes and compare a classifier trained for that decision."}]},{"t":"p","runs":[{"text":"Representations can also carry harmful associations. Bolukbasi and colleagues’ 2016 study demonstrated gender stereotypes in particular word embeddings trained on Google News. Such findings are a reason to test downstream applications for unfair outcomes; they do not prove how any specific hiring product behaves."}]},{"t":"p","runs":[{"text":"Use embeddings as evidence for a defined retrieval or prediction task, and evaluate that task. Similarity alone is not a check of truth, entailment or fairness. A retrieved passage still needs to be read and compared with the question."}]},{"t":"h2","id":"why-this-lesson-matters-more-than-it-looks","runs":[{"text":"Why this lesson matters more than it looks"}]},{"t":"p","runs":[{"text":"When an assistant says it “remembers documents” or “finds similar cases”, ask how the product implements that claim. Embeddings may be involved, but so may ordinary search, summaries, databases and other components. Knowing the retrieval path helps you investigate a wrong file or a missing source."}]}],"check":{"question":[{"text":"A nearest-example triage tool routes many enthusiastic thank-you messages about a product into its complaints queue. Which is a plausible failure to investigate in a general-purpose embedding system?"}],"options":[{"text":[{"text":"The embedding model was too small at 384 dimensions to separate the two classes, and a larger model would fix it."}],"correct":false,"tempting":[{"text":"Dimension count alone does not diagnose the error or guarantee a fix. The training objective, examples and decision rule matter."}]},{"text":[{"text":"The representation may emphasise a shared topic more than positive versus negative sentiment, making opposite opinions close under its similarity measure."}],"correct":true,"tempting":null},{"text":[{"text":"The labelled examples were imbalanced, with too many complaints, biasing every match towards that class."}],"correct":false,"tempting":[{"text":"Imbalance can affect a nearest-example system too, but this option assumes a dataset problem not established by the question. Inspect it rather than ruling it out."}]},{"text":[{"text":"Cosine similarity ignores the direction of the vectors and measures only their length."}],"correct":false,"tempting":[{"text":"Cosine similarity compares directions, equivalently the normalised dot product; it does not measure only length."}]}],"order":[0,2,3,1],"why":null},"prev":{"slug":"attention-what-it-does","title":"Attention, without a single equation","minutes":9},"next":{"slug":"the-context-window","title":"The desk it works on, and what falls off it","minutes":9}}}